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.

FieldFinder - class

class FieldFinder 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

Field 查找类。

可通过指定类型查找指定 Field 或一组 Field

classSet - field

Change Records

v1.0 first

v1.0.2 移除

name - field

var name: String

Change Records

v1.0 first

v1.0.70 modified

允许不填写名称

Function Illustrate

设置 Field 名称。

Pay Attention

若不填写名称则必须存在一个其它条件。

type - field

var type: Any?

Change Records

v1.0 first

Function Illustrate

设置 Field 类型。

可不填写类型。

modifiers - method

fun modifiers(conditions: ModifierConditions): IndexTypeCondition

Change Records

v1.0.67 added

v1.0.80 modified

将方法体进行 inline

v1.1.0 modified

合并到 ModifierConditions

Function Illustrate

设置 Field 标识符筛选条件。

可不设置筛选条件。

Pay Attention

存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。

order - method

fun order(): IndexTypeCondition

Change Records

v1.0.70 added

Function Illustrate

顺序筛选字节码的下标。

name - method

fun name(value: String): IndexTypeCondition

Change Records

v1.0.70 added

Function Illustrate

设置 Field 名称。

Pay Attention

若不填写名称则必须存在一个其它条件。

存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。

name - method

fun name(conditions: NameConditions): IndexTypeCondition

Change Records

v1.0.88 added

v1.1.0 modified

合并到 NameConditions

Function Illustrate

设置 Field 名称条件。

Pay Attention

若不填写名称则必须存在一个其它条件。

存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。

type - method

fun type(value: Any): IndexTypeCondition

Change Records

v1.0.70 added

Function Illustrate

设置 Field 类型。

可不填写类型。

Pay Attention

存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。

type - method

fun type(conditions: ObjectConditions): IndexTypeCondition

Change Records

v1.1.5 added

Function Illustrate

设置 Field 类型条件。

可不填写类型。

Pay Attention

存在多个 IndexTypeCondition 时除了 order 只会生效最后一个。

superClass - method

fun superClass(isOnlySuperClass: Boolean)

Change Records

v1.0.80 added

Function Illustrate

设置在 classSet 的所有父类中查找当前 Field

Notice

若当前 classSet 的父类较多可能会耗时,API 会自动循环到父类继承是 Any 前的最后一个类。

RemedyPlan - class

inner class RemedyPlan internal constructor()

Change Records

v1.1.0 added

Function Illustrate

Field 重查找实现类,可累计失败次数直到查找成功。

field - method

inline fun field(initiate: FieldConditions): Result

Change Records

v1.1.0 added

Function Illustrate

创建需要重新查找的 Field

你可以添加多个备选 Field,直到成功为止,若最后依然失败,将停止查找并输出错误日志。

Result - class

inner class Result internal constructor()

Change Records

v1.1.0 added

Function Illustrate

RemedyPlan 结果实现类。

onFind - method

fun onFind(initiate: MutableList<Field>.() -> Unit)

Change Records

v1.1.0 added

v1.2.0 modified

initiate 类型由 HashSet 修改为 MutableList

Function Illustrate

当在 RemedyPlan 中找到结果时。

功能示例

你可以方便地对重查找的 Field 实现 onFind 方法。

示例如下

field {
    // 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 first

v1.1.0 modified

继承到接口 BaseResult

Function Illustrate

Field 查找结果实现类。

result - method

inline fun result(initiate: Result.() -> Unit): Result

Change Records

v1.0 first

v1.0.80 modified

将方法体进行 inline

Function Illustrate

创建监听结果事件方法体。

功能示例

你可以使用 lambda 形式创建 Result 类。

示例如下

field {
    // Your code here.
}.result {
    get(instance).set("something")
    get(instance).string()
    get(instance).cast<CustomClass>()
    get().boolean()
    all(instance)
    give()
    giveAll()
    onNoSuchField {}
}

get - method

fun get(instance: Any?): Instance

Change Records

v1.0 first

Function Illustrate

获得 Field 实例处理类。

若有多个 Field 结果只会返回第一个。

功能示例

你可以轻松地得到 Field 的实例以及使用它进行设置实例。

示例如下

field {
    // Your code here.
}.get(instance).set("something")

如果你取到的是静态 Field,可以不需要设置实例。

示例如下

field {
    // Your code here.
}.get().set("something")

all - method

fun all(instance: Any?): MutableList<Instance>

Change Records

v1.1.0 added

v1.2.0 modified

返回值类型由 ArrayList 修改为 MutableList

Function Illustrate

获得 Field 实例处理类数组。

返回全部查找条件匹配的多个 Field 实例结果。

功能示例

你可以通过此方法来获得当前条件结果中匹配的全部 Field,其 Field 所在实例用法与 get 相同。

示例如下

field {
    // Your code here.
}.all(instance).forEach { instance ->
    instance.self
}

give - method

fun give(): Field?

Change Records

v1.0 first

Function Illustrate

得到 Field 本身。

若有多个 Field 结果只会返回第一个。

在查找条件找不到任何结果的时候将返回 null

giveAll - method

fun giveAll(): MutableList<Field>

Change Records

v1.1.0 added

v1.2.0 modified

返回值类型由 HashSet 修改为 MutableList

Function Illustrate

得到 Field 本身数组。

返回全部查找条件匹配的多个 Field 实例。

在查找条件找不到任何结果的时候将返回空的 MutableList

wait - method

fun wait(instance: Any?, initiate: Instance.() -> Unit)

Change Records

v1.1.0 added

Function Illustrate

获得 Field 实例处理类,配合 RemedyPlan 使用。

若有多个 Field 结果只会返回第一个。

Pay Attention

若你设置了 remedys 必须使用此方法才能获得结果。

若你没有设置 remedys 此方法将不会被回调。

waitAll - method

fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)

Change Records

v1.1.0 added

v1.2.0 modified

initiate 类型由 ArrayList 修改为 MutableList

Function Illustrate

获得 Field 实例处理类数组,配合 RemedyPlan 使用。

返回全部查找条件匹配的多个 Field 实例结果。

Pay Attention

若你设置了 remedys 必须使用此方法才能获得结果。

若你没有设置 remedys 此方法将不会被回调。

remedys - method

inline fun remedys(initiate: RemedyPlan.() -> Unit): Result

Change Records

v1.1.0 added

Function Illustrate

创建 Field 重查找功能。

功能示例

当你遇到一种 Field 可能存在不同形式的存在时,可以使用 RemedyPlan 重新查找它,而没有必要使用 onNoSuchField 捕获异常二次查找 Field

若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。

示例如下

field {
    // Your code here.
}.remedys {
    field {
        // Your code here.
    }
    field {
        // Your code here.
    }
}

onNoSuchField - method

fun onNoSuchField(result: (Throwable) -> Unit): Result

Change Records

v1.0 first

Function Illustrate

监听找不到 Field 时。

ignored - method

fun ignored(): Result

Change Records

v1.1.0 added

Function Illustrate

忽略异常并停止打印任何错误日志。

MemberBaseFinder.MemberHookerManager.isNotIgnoredNoSuchMemberFailurefalse 则自动忽略。

Notice

此时若要监听异常结果,你需要手动实现 onNoSuchField 方法。

ignoredError - method

Change Records

v1.0.3 added

v1.1.0 deprecated

请迁移到新方法 ignored()

Instance - class

inner class Instance internal constructor(private val instance: Any?, private val field: Field?)

Change Records

v1.0 first

v1.1.0 modified

新增 field 参数

不再对外公开 self 参数

Function Illustrate

Field 实例变量处理类。

self - field

Change Records

v1.0 first

v1.1.0 移除

请直接使用 any 方法得到 Field 自身的实例化对象

current - method

fun current(ignored: Boolean): CurrentClass?
inline fun current(ignored: Boolean, initiate: CurrentClass.() -> Unit): Any?

Change Records

v1.1.0 added

Function Illustrate

获得当前 Field 自身 self 实例的类操作对象 CurrentClass

cast - method

fun <T> cast(): T?

Change Records

v1.0 first

v1.0.68 modified

修改 ofcast

移动方法到 Instance

Function Illustrate

得到当前 Field 实例。

byte - method

fun byte(): Byte?

Change Records

v1.0.68 added

Function Illustrate

得到当前 Field Byte 实例。

int - method

fun int(): Int

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofIntint

移动方法到 Instance

Function Illustrate

得到当前 Field Int 实例。

long - method

fun long(): Long

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofLonglong

移动方法到 Instance

Function Illustrate

得到当前 Field Long 实例。

short - method

fun short(): Short

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofShortshort

移动方法到 Instance

Function Illustrate

得到当前 Field Short 实例。

double - method

fun double(): Double

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofDoubledouble

移动方法到 Instance

Function Illustrate

得到当前 Field Double 实例。

float - method

fun float(): Float

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofFloatfloat

移动方法到 Instance

Function Illustrate

得到当前 Field Float 实例。

string - method

fun string(): String

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofStringstring

移动方法到 Instance

Function Illustrate

得到当前 Field String 实例。

char - method

fun char(): Char

Change Records

v1.0.68 added

Function Illustrate

得到当前 Field Char 实例。

boolean - method

fun boolean(): Boolean

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofBooleanboolean

移动方法到 Instance

Function Illustrate

得到当前 Field Boolean 实例。

any - method

fun any(): Any?

Change Records

v1.0.65 added

v1.0.68 modified

修改 ofAnyany

移动方法到 Instance

Function Illustrate

得到当前 Field Any 实例。

array - method

inline fun <reified T> array(): Array<T>

Change Records

v1.0.68 added

Function Illustrate

得到当前 Field Array 实例。

list - method

inline fun <reified T> list(): List<T>

Change Records

v1.0.68 added

Function Illustrate

得到当前 Field List 实例。

set - method

fun set(any: Any?)

Change Records

v1.0 first

Function Illustrate

设置当前 Field 实例。

setTrue - method

fun setTrue()

Change Records

v1.0 first

Function Illustrate

设置当前 Field 实例为 true

Pay Attention

请确保实例对象类型为 Boolean

setFalse - method

fun setFalse()

Change Records

v1.0 first

Function Illustrate

设置当前 Field 实例为 false

Pay Attention

请确保实例对象类型为 Boolean

setNull - method

fun setNull()

Change Records

v1.0 first

Function Illustrate

设置当前 Field 实例为 null