import{_ as s,o as n,c as o,a as e}from"./app-BpUB8-Q8.js";const a={},l=e(`
Notice
Due to maintenance costs, the YukiHookAPI
will no longer update this document from version 1.3.0
and switch to the API document automatically generated by the Dokka plugin in version 2.0.0
.
Notice
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the Chrome Translation Plugin to translate entire pages for reference.
class ConstructorFinder internal constructor(override val classSet: Class<*>) : MemberBaseFinder
Change Records
v1.0
first
v1.0.2
modified
合并到 BaseFinder
v1.1.0
modified
合并到 MemberBaseFinder
v1.1.8
modified
移动 hookInstance
参数到 MemberBaseFinder.MemberHookerManager
Function Illustrate
Constructor
查找类。
可通过指定类型查找指定 Constructor
或一组 Constructor
。
var paramCount: Int
Change Records
v1.0.67
added
Function Illustrate
设置
Constructor
参数个数。
你可以不使用 param
指定参数类型而是仅使用此变量指定参数个数。
若参数个数小于零则忽略并使用 param
。
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
Change Records
v1.0.67
added
v1.0.80
modified
将方法体进行 inline
v1.1.0
modified
合并到 ModifierConditions
Function Illustrate
设置
Constructor
标识符筛选条件。
可不设置筛选条件,默认模糊查找并取第一个匹配的 Constructor
。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun emptyParam(): IndexTypeCondition
Change Records
v1.0.75
added
Function Illustrate
设置
Constructor
空参数、无参数。
fun param(vararg paramType: Any): IndexTypeCondition
Change Records
v1.0
first
Function Illustrate
设置
Constructor
参数。
如果同时使用了 paramCount
则 paramType
的数量必须与 paramCount
完全匹配。
如果 Constructor
中存在一些无意义又很长的类型,你可以使用 VagueType 来替代它。
Pay Attention
无参 Constructor 请使用 emptyParam 设置查找条件。
有参 Constructor 必须使用此方法设定参数或使用 paramCount 指定个数。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun param(conditions: ObjectsConditions): IndexTypeCondition
Change Records
v1.1.5
added
Function Illustrate
设置
Constructor
参数条件。
Pay Attention
无参 Constructor 请使用 emptyParam 设置查找条件。
有参 Constructor 必须使用此方法设定参数或使用 paramCount 指定个数。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun paramCount(num: Int): IndexTypeCondition
Change Records
v1.0.70
added
Function Illustrate
设置
Constructor
参数个数。
你可以不使用 param
指定参数类型而是仅使用此方法指定参数个数。
若参数个数小于零则忽略并使用 param
。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun paramCount(numRange: IntRange): IndexTypeCondition
Change Records
v1.1.0
added
Function Illustrate
设置
Constructor
参数个数范围。
你可以不使用 param
指定参数类型而是仅使用此方法指定参数个数范围。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun paramCount(conditions: CountConditions): IndexTypeCondition
Change Records
v1.1.0
added
Function Illustrate
设置
Constructor
参数个数条件。
你可以不使用 param
指定参数类型而是仅使用此方法指定参数个数条件。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
fun superClass(isOnlySuperClass: Boolean)
Change Records
v1.0.80
added
Function Illustrate
设置在
classSet
的所有父类中查找当前Constructor
。
Notice
若当前 classSet 的父类较多可能会耗时,API 会自动循环到父类继承是 Any 前的最后一个类。
inner class RemedyPlan internal constructor()
Change Records
v1.0
first
Function Illustrate
Constructor
重查找实现类,可累计失败次数直到查找成功。
inline fun constructor(initiate: ConstructorConditions)
Change Records
v1.0
first
v1.0.80
modified
将方法体进行 inline
Function Illustrate
创建需要重新查找的
Constructor
。
你可以添加多个备选 Constructor
,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
inner class Result internal constructor()
Change Records
v1.0.1
added
Function Illustrate
RemedyPlan
结果实现类。
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit)
Change Records
v1.0.1
added
v1.1.0
modified
initiate
参数 Constructor
变为 HashSet<Constructor>
v1.2.0
modified
initiate
类型由 HashSet
修改为 MutableList
Function Illustrate
当在
RemedyPlan
中找到结果时。
Function Example
你可以方便地对重查找的 Constructor
实现 onFind
方法。
The following example
constructor {
// Your code here.
}.onFind {
// Your code here.
}
inner class Process internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
Change Records
v1.1.0
added
Function Illustrate
Constructor
查找结果处理类,为hookManager
提供。
inline fun result(initiate: Process.() -> Unit): Process
Change Records
v1.1.0
added
Function Illustrate
创建监听结果事件方法体。
Function Example
你可以使用 lambda 形式创建 Result
类。
The following example
constructor {
// Your code here.
}.result {
all()
remedys {}
onNoSuchConstructor {}
}
fun all(): Process
Change Records
v1.1.0
added
Function Illustrate
设置全部查找条件匹配的多个
Constructor
实例结果到hookManager
。
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
Change Records
v1.1.0
added
Function Illustrate
创建
Constructor
重查找功能。
Function Example
当你遇到一种 Constructor
可能存在不同形式的存在时,可以使用 RemedyPlan
重新查找它,而没有必要使用 onNoSuchConstructor
捕获异常二次查找 Constructor
。
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
The following example
constructor {
// Your code here.
}.remedys {
constructor {
// Your code here.
}
constructor {
// Your code here.
}
}
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
Change Records
v1.1.0
added
Function Illustrate
监听找不到
Constructor
时。
只会返回第一次的错误信息,不会返回 RemedyPlan
的错误信息。
inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
Change Records
v1.0
first
v1.1.0
modified
继承到接口 BaseResult
Function Illustrate
Constructor
查找结果实现类。
inline fun result(initiate: Result.() -> Unit): Result
Change Records
v1.0
first
v1.0.80
modified
将方法体进行 inline
Function Illustrate
创建监听结果事件方法体。
Function Example
你可以使用 lambda 形式创建 Result
类。
The following example
constructor {
// Your code here.
}.result {
get().call()
all()
remedys {}
onNoSuchConstructor {}
}
fun get(): Instance
Change Records
v1.0.2
added
Function Illustrate
获得
Constructor
实例处理类。
若有多个 Constructor
结果只会返回第一个。
Pay Attention
若你设置了 remedys 请使用 wait 回调结果方法。
Function Example
你可以通过获得方法所在实例来执行构造方法创建新的实例对象。
The following example
constructor {
// Your code here.
}.get().call()
你可以 cast
构造方法为指定类型的实例对象。
The following example
constructor {
// Your code here.
}.get().newInstance<TestClass>()
Pay Attention
若构造方法含有参数则后方参数必填。
The following example
constructor {
// Your code here.
}.get().newInstance<TestClass>("param1", "param2")
fun all(): MutableList<Instance>
Change Records
v1.1.0
added
v1.2.0
modified
返回值类型由 ArrayList
修改为 MutableList
Function Illustrate
获得
Constructor
实例处理类数组。
返回全部查找条件匹配的多个 Constructor
实例结果。
Function Example
你可以通过此方法来获得当前条件结果中匹配的全部 Constructor
。
The following example
constructor {
// Your code here.
}.all().forEach { instance ->
instance.call(...)
}
fun give(): Constructor<*>?
Change Records
v1.0.67
added
Function Illustrate
得到
Constructor
本身。
若有多个 Constructor
结果只会返回第一个。
在查找条件找不到任何结果的时候将返回 null
。
fun giveAll(): MutableList<Constructor<*>>
Change Records
v1.1.0
added
v1.2.0
modified
返回值类型由 HashSet
修改为 MutableList
Function Illustrate
得到
Constructor
本身数组。
返回全部查找条件匹配的多个 Constructor
实例。
在查找条件找不到任何结果的时候将返回空的 MutableList
。
fun wait(initiate: Instance.() -> Unit)
Change Records
v1.0.2
added
Function Illustrate
获得
Constructor
实例处理类,配合RemedyPlan
使用。
若有多个 Constructor
结果只会返回第一个。
Pay Attention
若你设置了 remedys 必须使用此方法才能获得结果。
若你没有设置 remedys 此方法将不会被回调。
fun waitAll(initiate: MutableList<Instance>.() -> Unit)
Change Records
v1.1.0
added
v1.2.0
modified
initiate
类型由 ArrayList
修改为 MutableList
Function Illustrate
获得
Constructor
实例处理类数组,配合RemedyPlan
使用。
返回全部查找条件匹配的多个 Constructor
实例结果。
Pay Attention
若你设置了 remedys 必须使用此方法才能获得结果。
若你没有设置 remedys 此方法将不会被回调。
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
Change Records
v1.0
first
v1.0.80
modified
将方法体进行 inline
Function Illustrate
创建
Constructor
重查找功能。
Function Example
当你遇到一种 Constructor
可能存在不同形式的存在时,可以使用 RemedyPlan
重新查找它,而没有必要使用 onNoSuchConstructor
捕获异常二次查找 Constructor
。
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
The following example
constructor {
// Your code here.
}.remedys {
constructor {
// Your code here.
}
constructor {
// Your code here.
}
}
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
Change Records
v1.0
first
v1.0.80
modified
将方法体进行 inline
Function Illustrate
监听找不到
Constructor
时。
只会返回第一次的错误信息,不会返回 RemedyPlan
的错误信息。
fun ignored(): Result
Change Records
v1.1.0
added
Function Illustrate
忽略异常并停止打印任何错误日志。
若 MemberBaseFinder.MemberHookerManager.isNotIgnoredNoSuchMemberFailure
为 false
则自动忽略。
Notice
此时若要监听异常结果,你需要手动实现 onNoSuchConstructor 方法。
Change Records
v1.0.3
added
v1.1.0
deprecated
请迁移到新方法 ignored()
inner class Instance internal constructor(private val constructor: Constructor<*>?)
Change Records
v1.0.2
added
v1.1.0
modified
新增 constructor
参数
Function Illustrate
Constructor
实例处理类。
fun call(vararg args: Any?): Any?
Change Records
v1.0.2
added
v1.1.6
modified
修改参数命名 param
为 args
Function Illustrate
执行
Constructor
创建目标实例,不指定目标实例类型。
fun <T> newInstance(vararg args: Any?): T?
Change Records
v1.0.2
added
v1.1.6
modified
修改参数命名 param
为 args
Function Illustrate
`,310),p=[l];function c(t,r){return n(),o("div",null,p)}const i=s(a,[["render",c],["__file","ConstructorFinder.html.vue"]]);export{i as default};执行
Constructor
创建目标实例 ,指定T
目标实例类型。