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.
MethodFinder - class
class MethodFinder internal constructor(override val classSet: Class<*>) : MemberBaseFinder
Change Records
v1.0.0 first
Function Illustrate
Method查找类。
可通过指定类型查找指定 Method 或一组 Method。
name - field
var name: String
Change Records
v1.0.0 first
Function Illustrate
设置
Method名称。
Pay Attention
若不填写名称则必须存在一个其它条件。
paramCount - field
var paramCount: Int
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数个数。
你可以不使用 param 指定参数类型而是仅使用此变量指定参数个数。
若参数个数小于零则忽略并使用 param。
returnType - field
var returnType: Any?
Change Records
v1.0.0 first
Function Illustrate
设置
Method返回值,可不填写返回值。
modifiers - method
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method标识符筛选条件。
可不设置筛选条件。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
emptyParam - method
fun emptyParam(): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method空参数、无参数。
param - method
fun param(vararg paramType: Any): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数。
如果同时使用了 paramCount 则 paramType 的数量必须与 paramCount 完全匹配。
如果 Method 中存在一些无意义又很长的类型,你可以使用 VagueType 来替代它。
Pay Attention
无参 Method 请使用 emptyParam 设置查找条件。
有参 Method 必须使用此方法设定参数或使用 paramCount 指定个数。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
param - method
fun param(conditions: ObjectsConditions): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数条件。
Pay Attention
无参 Method 请使用 emptyParam 设置查找条件。
有参 Method 必须使用此方法设定参数或使用 paramCount 指定个数。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
order - method
fun order(): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
顺序筛选字节码的下标。
name - method
fun name(value: String): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method名称。
Pay Attention
若不填写名称则必须存在一个其它条件。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
name - method
fun name(conditions: NameConditions): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method名称条件。
Pay Attention
若不填写名称则必须存在一个其它条件。
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
paramCount - method
fun paramCount(num: Int): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数个数。
你可以不使用 param 指定参数类型而是仅使用此方法指定参数个数。
若参数个数小于零则忽略并使用 param。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
paramCount - method
fun paramCount(numRange: IntRange): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数个数范围。
你可以不使用 param 指定参数类型而是仅使用此方法指定参数个数范围。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
paramCount - method
fun paramCount(conditions: CountConditions): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method参数个数条件。
你可以不使用 param 指定参数类型而是仅使用此方法指定参数个数条件。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
returnType - method
fun returnType(value: Any): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method返回值。
可不填写返回值。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
returnType - method
fun returnType(conditions: ObjectConditions): IndexTypeCondition
Change Records
v1.0.0 first
Function Illustrate
设置
Method返回值条件。
可不填写返回值。
Pay Attention
存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。
superClass - method
fun superClass(isOnlySuperClass: Boolean)
Change Records
v1.0.0 first
Function Illustrate
设置在
classSet的所有父类中查找当前Method。
Notice
若当前 classSet 的父类较多可能会耗时,API 会自动循环到父类继承是 Any 前的最后一个类。
RemedyPlan - class
inner class RemedyPlan internal constructor()
Change Records
v1.0.0 first
Function Illustrate
Method重查找实现类,可累计失败次数直到查找成功。
method - method
inline fun method(initiate: MethodConditions): Result
Change Records
v1.0.0 first
Function Illustrate
创建需要重新查找的
Method。
你可以添加多个备选 Method,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
Result - class
inner class Result internal constructor()
Change Records
v1.0.0 first
Function Illustrate
RemedyPlan结果实现类。
onFind - method
fun onFind(initiate: MutableList<Method>.() -> Unit)
Change Records
v1.0.0 first
v1.0.3 修改
initiate 类型由 HashSet 修改为 MutableList
Function Illustrate
当在
RemedyPlan中找到结果时。
Function Example
你可以方便地对重查找的 Method 实现 onFind 方法。
The following example
method {
// Your code here.
}.onFind {
// Your code here.
}
Result - class
inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
Change Records
v1.0.0 first
Function Illustrate
Method查找结果实现类。
result - method
inline fun result(initiate: Result.() -> Unit): Result
Change Records
v1.0.0 first
Function Illustrate
创建监听结果事件方法体。
Function Example
你可以使用 lambda 形式创建 Result 类。
The following example
method {
// Your code here.
}.result {
get(instance).call()
all(instance)
remedys {}
onNoSuchMethod {}
}
get - method
fun get(instance: Any?): Instance
Change Records
v1.0.0 first
Function Illustrate
获得
Method实例处理类。
若有多个 Method 结果只会返回第一个。
Pay Attention
若你设置了 remedys 请使用 wait 回调结果方法。
Function Example
你可以通过获得方法所在实例来执行 Method。
The following example
method {
// Your code here.
}.get(instance).call()
若当前为静态方法,你可以不设置实例。
The following example
method {
// Your code here.
}.get().call()
all - method
fun all(instance: Any?): MutableList<Instance>
Change Records
v1.0.0 first
v1.0.3 修改
返回值类型由 ArrayList 修改为 MutableList
Function Illustrate
获得
Method实例处理类数组。
返回全部查找条件匹配的多个 Method 实例结果。
Function Example
你可以通过此方法来获得当前条件结果中匹配的全部 Method,其方法所在实例用法与 get 相同。
The following example
method {
// Your code here.
}.all(instance).forEach { instance ->
instance.call(...)
}
give - method
fun give(): Method?
Change Records
v1.0.0 first
Function Illustrate
得到
Method本身。
若有多个 Method 结果只会返回第一个。
在查找条件找不到任何结果的时候将返回 null。
giveAll - method
fun giveAll(): MutableList<Method>
Change Records
v1.0.0 first
v1.0.3 修改
返回值类型由 HashSet 修改为 MutableList
Function Illustrate
得到
Method本身数组。
返回全部查找条件匹配的多个 Method 实例。
在查找条件找不到任何结果的时候将返回空的 MutableList。
wait - method
fun wait(instance: Any?, initiate: Instance.() -> Unit)
Change Records
v1.0.0 first
Function Illustrate
获得
Method实例处理类,配合RemedyPlan使用。
若有多个 Method 结果只会返回第一个。
Pay Attention
若你设置了 remedys 必须使用此方法才能获得结果。
若你没有设置 remedys 此方法将不会被回调。
waitAll - method
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
Change Records
v1.0.0 first
v1.0.3 修改
initiate 类型由 ArrayList 修改为 MutableList
Function Illustrate
获得
Method实例处理类数组,配合RemedyPlan使用。
返回全部查找条件匹配的多个 Method 实例结果。
Pay Attention
若你设置了 remedys 必须使用此方法才能获得结果。
若你没有设置 remedys 此方法将不会被回调。
remedys - method
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
Change Records
v1.0.0 first
Function Illustrate
创建
Method重查找功能。
Function Example
当你遇到一种 Method 可能存在不同形式的存在时,可以使用 RemedyPlan 重新查找它,而没有必要使用 onNoSuchMethod 捕获异常二次查找 Method。
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
The following example
method {
// Your code here.
}.remedys {
method {
// Your code here.
}
method {
// Your code here.
}
}
onNoSuchMethod - method
inline fun onNoSuchMethod(result: (Throwable) -> Unit): Result
Change Records
v1.0.0 first
Function Illustrate
监听找不到
Method时。
只会返回第一次的错误信息,不会返回 RemedyPlan 的错误信息。
ignored - method
fun ignored(): Result
Change Records
v1.0.0 first
Function Illustrate
忽略异常并停止打印任何错误日志。
Notice
此时若要监听异常结果,你需要手动实现 onNoSuchMethod 方法。
Instance - class
inner class Instance internal constructor(private val instance: Any?, private val method: Method?)
Change Records
v1.0.0 first
Function Illustrate
Method实例处理类。
call - method
fun call(vararg args: Any?): Any?
Change Records
v1.0.0 first
Function Illustrate
执行
Method,不指定返回值类型。
invoke - method
fun <T> invoke(vararg args: Any?): T?
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定T返回值类型。
byte - method
fun byte(vararg args: Any?): Byte?
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Byte 返回值类型。
int - method
fun int(vararg args: Any?): Int
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Int 返回值类型。
long - method
fun long(vararg args: Any?): Long
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Long 返回值类型。
short - method
fun short(vararg args: Any?): Short
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Short 返回值类型。
double - method
fun double(vararg args: Any?): Double
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Double 返回值类型。
float - method
fun float(vararg args: Any?): Float
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Float 返回值类型。
string - method
fun string(vararg args: Any?): String
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 String 返回值类型。
char - method
fun char(vararg args: Any?): Char
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Char 返回值类型。
boolean - method
fun boolean(vararg args: Any?): Boolean
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Boolean 返回值类型。
array - method
inline fun <reified T> array(vararg args: Any?): Array<T>
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 Array 返回值类型。
list - method
inline fun <reified T> list(vararg args: Any?): List<T>
Change Records
v1.0.0 first
Function Illustrate
执行
Method,指定 List 返回值类型。
