mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
refactor: merge HashSet, ArrayList to MutableList
This commit is contained in:
@@ -625,20 +625,24 @@ fun get(): Class<*>?
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashSet<Class<*>>
|
||||
fun all(): MutableList<Class<*>>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
@@ -685,20 +689,24 @@ fun wait(result: (Class<*>?) -> Unit): Result
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result
|
||||
fun waitAll(result: (MutableList<Class<*>>) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`result` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将回调空的 `MutableList`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
|
@@ -291,7 +291,7 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
@@ -302,6 +302,10 @@ fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
|
||||
`initiate` 参数 `Constructor` 变为 `HashSet<Constructor>`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -543,13 +547,17 @@ constructor {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
fun all(): MutableList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
@@ -591,20 +599,24 @@ fun give(): Constructor<*>?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Constructor<*>>
|
||||
fun giveAll(): MutableList<Constructor<*>>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -633,13 +645,17 @@ fun wait(initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(initiate: ArrayList<Instance>.() -> Unit)
|
||||
fun waitAll(initiate: MutableList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -44,7 +44,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>?) : Membe
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.2` `removed`
|
||||
`v1.0.2` `移除`
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
@@ -289,22 +289,26 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Field>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Field>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**Function Example**
|
||||
**功能示例**
|
||||
|
||||
你可以方便地对重查找的 `Field` 实现 `onFind` 方法。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -350,11 +354,11 @@ inline fun result(initiate: Result.() -> Unit): Result
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**Function Example**
|
||||
**功能示例**
|
||||
|
||||
你可以使用 **lambda** 形式创建 `Result` 类。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -387,11 +391,11 @@ fun get(instance: Any?): Instance
|
||||
|
||||
若有多个 `Field` 结果只会返回第一个。
|
||||
|
||||
**Function Example**
|
||||
**功能示例**
|
||||
|
||||
你可以轻松地得到 `Field` 的实例以及使用它进行设置实例。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -401,7 +405,7 @@ field {
|
||||
|
||||
如果你取到的是静态 `Field`,可以不需要设置实例。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -412,24 +416,28 @@ field {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
fun all(instance: Any?): MutableList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例结果。
|
||||
|
||||
**Function Example**
|
||||
**功能示例**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -460,20 +468,24 @@ fun give(): Field?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Field>
|
||||
fun giveAll(): MutableList<Field>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -502,13 +514,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
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` 使用。
|
||||
@@ -537,13 +553,13 @@ inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
|
||||
> 创建 `Field` 重查找功能。
|
||||
|
||||
**Function Example**
|
||||
**功能示例**
|
||||
|
||||
当你遇到一种 `Field` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchField` 捕获异常二次查找 `Field`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> The following example
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
@@ -630,7 +646,7 @@ inner class Instance internal constructor(private val instance: Any?, private va
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `removed`
|
||||
`v1.1.0` `移除`
|
||||
|
||||
请直接使用 `any` 方法得到 `Field` 自身的实例化对象
|
||||
|
||||
|
@@ -435,7 +435,7 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Method>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Method>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
@@ -446,6 +446,10 @@ fun onFind(initiate: HashSet<Method>.() -> Unit)
|
||||
|
||||
`initiate` 参数 `Method` 变为 `HashSet<Method>`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -673,13 +677,17 @@ method {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
fun all(instance: Any?): MutableList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Method` 实例处理类数组。
|
||||
@@ -721,20 +729,24 @@ fun give(): Method?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Method>
|
||||
fun giveAll(): MutableList<Method>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Method` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -763,13 +775,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
`v1.2.0` `modified`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -617,20 +617,24 @@ fun get(): Class<*>?
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashSet<Class<*>>
|
||||
fun all(): MutableList<Class<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
@@ -677,20 +681,24 @@ fun wait(result: (Class<*>?) -> Unit): Result
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result
|
||||
fun waitAll(result: (MutableList<Class<*>>) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`result` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将回调空的 `MutableList`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
|
@@ -283,7 +283,7 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
@@ -294,6 +294,10 @@ fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
|
||||
`initiate` 参数 `Constructor` 变为 `HashSet<Constructor>`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -535,13 +539,17 @@ constructor {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
fun all(): MutableList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
@@ -583,20 +591,24 @@ fun give(): Constructor<*>?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Constructor<*>>
|
||||
fun giveAll(): MutableList<Constructor<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -625,13 +637,17 @@ fun wait(initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(initiate: ArrayList<Instance>.() -> Unit)
|
||||
fun waitAll(initiate: MutableList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -281,13 +281,17 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Field>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Field>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -404,13 +408,17 @@ field {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
fun all(instance: Any?): MutableList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
@@ -452,20 +460,24 @@ fun give(): Field?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Field>
|
||||
fun giveAll(): MutableList<Field>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -494,13 +506,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -427,7 +427,7 @@ inner class Result internal constructor()
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Method>.() -> Unit)
|
||||
fun onFind(initiate: MutableList<Method>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
@@ -438,6 +438,10 @@ fun onFind(initiate: HashSet<Method>.() -> Unit)
|
||||
|
||||
`initiate` 参数 `Method` 变为 `HashSet<Method>`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -665,13 +669,17 @@ method {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
fun all(instance: Any?): MutableList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类数组。
|
||||
@@ -713,20 +721,24 @@ fun give(): Method?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Method>
|
||||
fun giveAll(): MutableList<Method>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Method` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -755,13 +767,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.1.0` `新增`
|
||||
|
||||
`v1.2.0` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -44,7 +44,7 @@ abstract class ClassBaseFinder internal constructor(internal open val loaderSet:
|
||||
}
|
||||
|
||||
/** 当前找到的 [Class] 数组 */
|
||||
internal var classInstances = HashSet<Class<*>>()
|
||||
internal var classInstances = mutableListOf<Class<*>>()
|
||||
|
||||
/** 是否开启忽略错误警告功能 */
|
||||
internal var isIgnoreErrorLogs = false
|
||||
|
@@ -60,28 +60,28 @@ abstract class MemberBaseFinder internal constructor(private val tag: String, in
|
||||
internal var isIgnoreErrorLogs = false
|
||||
|
||||
/** 当前找到的 [Member] 数组 */
|
||||
internal var memberInstances = HashSet<Member>()
|
||||
internal var memberInstances = mutableListOf<Member>()
|
||||
|
||||
/**
|
||||
* 将 [HashSet]<[Member]> 转换为 [HashSet]<[Field]>
|
||||
* @return [HashSet]<[Field]>
|
||||
* 将 [MutableList]<[Member]> 转换为 [MutableList]<[Field]>
|
||||
* @return [MutableList]<[Field]>
|
||||
*/
|
||||
internal fun HashSet<Member>.fields() =
|
||||
hashSetOf<Field>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Field?)?.also { f -> it.add(f) } } }
|
||||
internal fun MutableList<Member>.fields() =
|
||||
mutableListOf<Field>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Field?)?.also { f -> it.add(f) } } }
|
||||
|
||||
/**
|
||||
* 将 [HashSet]<[Member]> 转换为 [HashSet]<[Method]>
|
||||
* @return [HashSet]<[Method]>
|
||||
* 将 [MutableList]<[Member]> 转换为 [MutableList]<[Method]>
|
||||
* @return [MutableList]<[Method]>
|
||||
*/
|
||||
internal fun HashSet<Member>.methods() =
|
||||
hashSetOf<Method>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Method?)?.also { m -> it.add(m) } } }
|
||||
internal fun MutableList<Member>.methods() =
|
||||
mutableListOf<Method>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Method?)?.also { m -> it.add(m) } } }
|
||||
|
||||
/**
|
||||
* 将 [HashSet]<[Member]> 转换为 [HashSet]<[Constructor]>
|
||||
* @return [HashSet]<[Constructor]>
|
||||
* 将 [MutableList]<[Member]> 转换为 [MutableList]<[Constructor]>
|
||||
* @return [MutableList]<[Constructor]>
|
||||
*/
|
||||
internal fun HashSet<Member>.constructors() =
|
||||
hashSetOf<Constructor<*>>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Constructor<*>?)?.also { c -> it.add(c) } } }
|
||||
internal fun MutableList<Member>.constructors() =
|
||||
mutableListOf<Constructor<*>>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Constructor<*>?)?.also { c -> it.add(c) } } }
|
||||
|
||||
/**
|
||||
* 将目标类型转换为可识别的兼容类型
|
||||
@@ -169,7 +169,7 @@ abstract class MemberBaseFinder internal constructor(private val tag: String, in
|
||||
* 绑定 [Member] 数组到当前 Hooker
|
||||
* @param members 当前 [Member] 数组
|
||||
*/
|
||||
internal fun bindMembers(members: HashSet<Member>) {
|
||||
internal fun bindMembers(members: MutableList<Member>) {
|
||||
instance?.members?.clear()
|
||||
members.forEach { instance?.members?.add(it) }
|
||||
}
|
||||
|
@@ -435,29 +435,29 @@ class DexClassFinder internal constructor(
|
||||
|
||||
/**
|
||||
* 得到 [Class] 或一组 [Class]
|
||||
* @return [HashSet]<[Class]>
|
||||
* @return [MutableList]<[Class]>
|
||||
* @throws NoClassDefFoundError 如果找不到 [Class]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findClasses(loaderSet, rulesData)
|
||||
|
||||
/**
|
||||
* 从本地缓存读取 [Class] 数据
|
||||
* @return [HashSet]<[Class]>
|
||||
* @return [MutableList]<[Class]>
|
||||
*/
|
||||
private fun readFromCache(): HashSet<Class<*>> =
|
||||
private fun readFromCache(): MutableList<Class<*>> =
|
||||
if (async && name.isNotBlank()) currentContext?.let {
|
||||
hashSetOf<Class<*>>().also { classes ->
|
||||
mutableListOf<Class<*>>().also { classes ->
|
||||
it.currentSp().getStringSet(name, emptySet())?.takeIf { it.isNotEmpty() }
|
||||
?.forEach { className -> if (className.hasClass(loaderSet)) classes.add(className.toClass(loaderSet)) }
|
||||
}
|
||||
} ?: let { SystemClock.sleep(1); readFromCache() } else hashSetOf()
|
||||
} ?: let { SystemClock.sleep(1); readFromCache() } else mutableListOf()
|
||||
|
||||
/**
|
||||
* 将当前 [Class] 数组名称保存到本地缓存
|
||||
* @throws IllegalStateException 如果当前包名为 "android"
|
||||
*/
|
||||
private fun HashSet<Class<*>>.saveToCache() {
|
||||
if (name.isNotBlank() && isNotEmpty()) hashSetOf<String>().also { names ->
|
||||
private fun MutableList<Class<*>>.saveToCache() {
|
||||
if (name.isNotBlank() && isNotEmpty()) mutableSetOf<String>().also { names ->
|
||||
takeIf { it.isNotEmpty() }?.forEach { names.add(it.name) }
|
||||
currentContext?.also {
|
||||
if (it.packageName == "android") error("Cannot create classes cache for \"android\", please remove \"name\" param")
|
||||
@@ -470,7 +470,7 @@ class DexClassFinder internal constructor(
|
||||
* 设置实例
|
||||
* @param classes 当前找到的 [Class] 数组
|
||||
*/
|
||||
private fun setInstance(classes: HashSet<Class<*>>) {
|
||||
private fun setInstance(classes: MutableList<Class<*>>) {
|
||||
classInstances.clear()
|
||||
classes.takeIf { it.isNotEmpty() }?.forEach { classInstances.add(it) }
|
||||
}
|
||||
@@ -515,7 +515,7 @@ class DexClassFinder internal constructor(
|
||||
internal var waitResultCallback: ((Class<*>?) -> Unit)? = null
|
||||
|
||||
/** 异步方法体回调数组结果 */
|
||||
internal var waitAllResultCallback: ((HashSet<Class<*>>) -> Unit)? = null
|
||||
internal var waitAllResultCallback: ((MutableList<Class<*>>) -> Unit)? = null
|
||||
|
||||
/** 异常结果重新回调方法体 */
|
||||
internal var noClassDefFoundErrorCallback: (() -> Unit)? = null
|
||||
@@ -544,10 +544,10 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 返回全部查找条件匹配的多个 [Class] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [HashSet]
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
*
|
||||
* - 若你设置了 [async] 请使用 [waitAll] 方法
|
||||
* @return [HashSet]<[Class]>
|
||||
* @return [MutableList]<[Class]>
|
||||
*/
|
||||
fun all() = classInstances
|
||||
|
||||
@@ -588,13 +588,13 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 回调全部查找条件匹配的多个 [Class] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将回调空的 [HashSet]
|
||||
* - 在查找条件找不到任何结果的时候将回调空的 [MutableList]
|
||||
*
|
||||
* - 你需要设置 [async] 后此方法才会被回调 - 否则请使用 [all] 方法
|
||||
* @param result 回调 - ([HashSet]<[Class]>)
|
||||
* @param result 回调 - ([MutableList]<[Class]>)
|
||||
* @return [Result] 可继续向下监听
|
||||
*/
|
||||
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result {
|
||||
fun waitAll(result: (MutableList<Class<*>>) -> Unit): Result {
|
||||
waitAllResultCallback = result
|
||||
return this
|
||||
}
|
||||
|
@@ -239,7 +239,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
|
||||
/**
|
||||
* 得到 [Constructor] 或一组 [Constructor]
|
||||
* @return [HashSet]<[Constructor]>
|
||||
* @return [MutableList]<[Constructor]>
|
||||
* @throws NoSuchMethodError 如果找不到 [Constructor]
|
||||
*/
|
||||
private val result by lazy { ReflectionTool.findConstructors(usedClassSet, rulesData) }
|
||||
@@ -248,7 +248,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* 设置实例
|
||||
* @param constructors 当前找到的 [Constructor] 数组
|
||||
*/
|
||||
private fun setInstance(constructors: HashSet<Constructor<*>>) {
|
||||
private fun setInstance(constructors: MutableList<Constructor<*>>) {
|
||||
memberInstances.clear()
|
||||
constructors.takeIf { it.isNotEmpty() }?.onEach { memberInstances.add(it) }
|
||||
?.first()?.apply { if (hookerManager.isMemberBinded) hookerManager.bindMember(member = this) }
|
||||
@@ -293,7 +293,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
private val remedyPlans = HashSet<Pair<ConstructorFinder, Result>>()
|
||||
private val remedyPlans = mutableSetOf<Pair<ConstructorFinder, Result>>()
|
||||
|
||||
/**
|
||||
* 创建需要重新查找的 [Constructor]
|
||||
@@ -344,13 +344,13 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
internal var onFindCallback: (HashSet<Constructor<*>>.() -> Unit)? = null
|
||||
internal var onFindCallback: (MutableList<Constructor<*>>.() -> Unit)? = null
|
||||
|
||||
/**
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit) {
|
||||
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
}
|
||||
@@ -378,7 +378,7 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
fun all(): Process {
|
||||
fun HashSet<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
fun MutableList<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
if (isUsingRemedyPlan)
|
||||
remedyPlansCallback = { memberInstances.bind() }
|
||||
else memberInstances.bind()
|
||||
@@ -452,9 +452,9 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 在 [memberInstances] 结果为空时使用此方法将无法获得对象
|
||||
*
|
||||
* - 若你设置了 [remedys] 请使用 [waitAll] 回调结果方法
|
||||
* @return [ArrayList]<[Instance]>
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
fun all() = arrayListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(it)) } }
|
||||
fun all() = mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(it)) } }
|
||||
|
||||
/**
|
||||
* 得到 [Constructor] 本身
|
||||
@@ -471,10 +471,10 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
*
|
||||
* - 返回全部查找条件匹配的多个 [Constructor] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [HashSet]
|
||||
* @return [HashSet]<[Constructor]>
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Constructor]>
|
||||
*/
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.constructors() ?: HashSet()
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.constructors() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
* 获得 [Constructor] 实例处理类
|
||||
@@ -499,9 +499,9 @@ class ConstructorFinder internal constructor(override val classSet: Class<*>? =
|
||||
* - 若你设置了 [remedys] 必须使用此方法才能获得结果
|
||||
*
|
||||
* - 若你没有设置 [remedys] 此方法将不会被回调
|
||||
* @param initiate 回调 [ArrayList]<[Instance]>
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
fun waitAll(initiate: ArrayList<Instance>.() -> Unit) {
|
||||
fun waitAll(initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all())
|
||||
else remedyPlansCallback = { initiate(all()) }
|
||||
}
|
||||
|
@@ -195,7 +195,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
|
||||
/**
|
||||
* 得到 [Field] 或一组 [Field]
|
||||
* @return [HashSet]<[Field]>
|
||||
* @return [MutableList]<[Field]>
|
||||
* @throws NoSuchFieldError 如果找不到 [Field]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findFields(usedClassSet, rulesData)
|
||||
@@ -204,7 +204,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 设置实例
|
||||
* @param fields 当前找到的 [Field] 数组
|
||||
*/
|
||||
private fun setInstance(fields: HashSet<Field>) {
|
||||
private fun setInstance(fields: MutableList<Field>) {
|
||||
memberInstances.clear()
|
||||
fields.takeIf { it.isNotEmpty() }?.forEach { memberInstances.add(it) }
|
||||
}
|
||||
@@ -241,7 +241,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
private val remedyPlans = HashSet<Pair<FieldFinder, Result>>()
|
||||
private val remedyPlans = mutableSetOf<Pair<FieldFinder, Result>>()
|
||||
|
||||
/**
|
||||
* 创建需要重新查找的 [Field]
|
||||
@@ -293,13 +293,13 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
internal var onFindCallback: (HashSet<Field>.() -> Unit)? = null
|
||||
internal var onFindCallback: (MutableList<Field>.() -> Unit)? = null
|
||||
|
||||
/**
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
fun onFind(initiate: HashSet<Field>.() -> Unit) {
|
||||
fun onFind(initiate: MutableList<Field>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
}
|
||||
@@ -349,10 +349,10 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 若你设置了 [remedys] 请使用 [waitAll] 回调结果方法
|
||||
* @param instance [Field] 所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @return [ArrayList]<[Instance]>
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
fun all(instance: Any? = null) =
|
||||
arrayListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
|
||||
/**
|
||||
* 得到 [Field] 本身
|
||||
@@ -369,10 +369,10 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 返回全部查找条件匹配的多个 [Field] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [HashSet]
|
||||
* @return [HashSet]<[Field]>
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Field]>
|
||||
*/
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.fields() ?: HashSet()
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.fields() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
* 获得 [Field] 实例处理类
|
||||
@@ -399,9 +399,9 @@ class FieldFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 若你没有设置 [remedys] 此方法将不会被回调
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [ArrayList]<[Instance]>
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
fun waitAll(instance: Any? = null, initiate: ArrayList<Instance>.() -> Unit) {
|
||||
fun waitAll(instance: Any? = null, initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all(instance))
|
||||
else remedyPlansCallback = { initiate(all(instance)) }
|
||||
}
|
||||
|
@@ -332,7 +332,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
|
||||
/**
|
||||
* 得到 [Method] 或一组 [Method]
|
||||
* @return [HashSet]<[Method]>
|
||||
* @return [MutableList]<[Method]>
|
||||
* @throws NoSuchMethodError 如果找不到 [Method]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findMethods(usedClassSet, rulesData)
|
||||
@@ -341,7 +341,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* 设置实例
|
||||
* @param methods 当前找到的 [Method] 数组
|
||||
*/
|
||||
private fun setInstance(methods: HashSet<Method>) {
|
||||
private fun setInstance(methods: MutableList<Method>) {
|
||||
memberInstances.clear()
|
||||
methods.takeIf { it.isNotEmpty() }?.onEach { memberInstances.add(it) }
|
||||
?.first()?.apply { if (hookerManager.isMemberBinded) hookerManager.bindMember(member = this) }
|
||||
@@ -386,7 +386,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
inner class RemedyPlan internal constructor() {
|
||||
|
||||
/** 失败尝试次数数组 */
|
||||
private val remedyPlans = HashSet<Pair<MethodFinder, Result>>()
|
||||
private val remedyPlans = mutableSetOf<Pair<MethodFinder, Result>>()
|
||||
|
||||
/**
|
||||
* 创建需要重新查找的 [Method]
|
||||
@@ -438,13 +438,13 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
inner class Result internal constructor() {
|
||||
|
||||
/** 找到结果时的回调 */
|
||||
internal var onFindCallback: (HashSet<Method>.() -> Unit)? = null
|
||||
internal var onFindCallback: (MutableList<Method>.() -> Unit)? = null
|
||||
|
||||
/**
|
||||
* 当找到结果时
|
||||
* @param initiate 回调
|
||||
*/
|
||||
fun onFind(initiate: HashSet<Method>.() -> Unit) {
|
||||
fun onFind(initiate: MutableList<Method>.() -> Unit) {
|
||||
onFindCallback = initiate
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
* @return [Process] 可继续向下监听
|
||||
*/
|
||||
fun all(): Process {
|
||||
fun HashSet<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
fun MutableList<Member>.bind() = takeIf { it.isNotEmpty() }?.apply { hookerManager.bindMembers(members = this) }.unit()
|
||||
if (isUsingRemedyPlan)
|
||||
remedyPlansCallback = { memberInstances.bind() }
|
||||
else memberInstances.bind()
|
||||
@@ -548,10 +548,10 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 若你设置了 [remedys] 请使用 [waitAll] 回调结果方法
|
||||
* @param instance 所在实例
|
||||
* @return [ArrayList]<[Instance]>
|
||||
* @return [MutableList]<[Instance]>
|
||||
*/
|
||||
fun all(instance: Any? = null) =
|
||||
arrayListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
mutableListOf<Instance>().apply { giveAll().takeIf { it.isNotEmpty() }?.forEach { add(Instance(instance, it)) } }
|
||||
|
||||
/**
|
||||
* 得到 [Method] 本身
|
||||
@@ -568,10 +568,10 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 返回全部查找条件匹配的多个 [Method] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [HashSet]
|
||||
* @return [HashSet]<[Method]>
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
* @return [MutableList]<[Method]>
|
||||
*/
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.methods() ?: HashSet()
|
||||
fun giveAll() = memberInstances.takeIf { it.isNotEmpty() }?.methods() ?: mutableListOf()
|
||||
|
||||
/**
|
||||
* 获得 [Method] 实例处理类
|
||||
@@ -598,9 +598,9 @@ class MethodFinder internal constructor(override val classSet: Class<*>? = null)
|
||||
*
|
||||
* - 若你没有设置 [remedys] 此方法将不会被回调
|
||||
* @param instance 所在实例
|
||||
* @param initiate 回调 [ArrayList]<[Instance]>
|
||||
* @param initiate 回调 [MutableList]<[Instance]>
|
||||
*/
|
||||
fun waitAll(instance: Any? = null, initiate: ArrayList<Instance>.() -> Unit) {
|
||||
fun waitAll(instance: Any? = null, initiate: MutableList<Instance>.() -> Unit) {
|
||||
if (memberInstances.isNotEmpty()) initiate(all(instance))
|
||||
else remedyPlansCallback = { initiate(all(instance)) }
|
||||
}
|
||||
|
@@ -151,12 +151,12 @@ internal object ReflectionTool {
|
||||
* 查找任意 [Class] 或一组 [Class]
|
||||
* @param loaderSet 类所在 [ClassLoader]
|
||||
* @param rulesData 规则查找数据
|
||||
* @return [HashSet]<[Class]>
|
||||
* @return [MutableList]<[Class]>
|
||||
* @throws IllegalStateException 如果 [loaderSet] 为 null 或未设置任何条件
|
||||
* @throws NoClassDefFoundError 如果找不到 [Class]
|
||||
*/
|
||||
internal fun findClasses(loaderSet: ClassLoader?, rulesData: ClassRulesData) = rulesData.createResult {
|
||||
hashSetOf<Class<*>>().also { classes ->
|
||||
mutableListOf<Class<*>>().also { classes ->
|
||||
/**
|
||||
* 开始查找作业
|
||||
* @param instance 当前 [Class] 实例
|
||||
@@ -294,14 +294,14 @@ internal object ReflectionTool {
|
||||
* 查找任意 [Field] 或一组 [Field]
|
||||
* @param classSet [Field] 所在类
|
||||
* @param rulesData 规则查找数据
|
||||
* @return [HashSet]<[Field]>
|
||||
* @return [MutableList]<[Field]>
|
||||
* @throws IllegalStateException 如果未设置任何条件或 [FieldRulesData.type] 目标类不存在
|
||||
* @throws NoSuchFieldError 如果找不到 [Field]
|
||||
*/
|
||||
internal fun findFields(classSet: Class<*>?, rulesData: FieldRulesData) = rulesData.createResult {
|
||||
if (type == UndefinedType) error("Field match type class is not found")
|
||||
if (classSet == null) return@createResult hashSetOf()
|
||||
hashSetOf<Field>().also { fields ->
|
||||
if (classSet == null) return@createResult mutableListOf()
|
||||
mutableListOf<Field>().also { fields ->
|
||||
classSet.existFields?.also { declares ->
|
||||
var iType = -1
|
||||
var iName = -1
|
||||
@@ -357,16 +357,16 @@ internal object ReflectionTool {
|
||||
* 查找任意 [Method] 或一组 [Method]
|
||||
* @param classSet [Method] 所在类
|
||||
* @param rulesData 规则查找数据
|
||||
* @return [HashSet]<[Method]>
|
||||
* @return [MutableList]<[Method]>
|
||||
* @throws IllegalStateException 如果未设置任何条件或 [MethodRulesData.paramTypes] 以及 [MethodRulesData.returnType] 目标类不存在
|
||||
* @throws NoSuchMethodError 如果找不到 [Method]
|
||||
*/
|
||||
internal fun findMethods(classSet: Class<*>?, rulesData: MethodRulesData) = rulesData.createResult {
|
||||
if (returnType == UndefinedType) error("Method match returnType class is not found")
|
||||
if (classSet == null) return@createResult hashSetOf()
|
||||
if (classSet == null) return@createResult mutableListOf()
|
||||
paramTypes?.takeIf { it.isNotEmpty() }
|
||||
?.forEachIndexed { p, it -> if (it == UndefinedType) error("Method match paramType[$p] class is not found") }
|
||||
hashSetOf<Method>().also { methods ->
|
||||
mutableListOf<Method>().also { methods ->
|
||||
classSet.existMethods?.also { declares ->
|
||||
var iReturnType = -1
|
||||
var iReturnTypeCds = -1
|
||||
@@ -468,15 +468,15 @@ internal object ReflectionTool {
|
||||
* 查找任意 [Constructor] 或一组 [Constructor]
|
||||
* @param classSet [Constructor] 所在类
|
||||
* @param rulesData 规则查找数据
|
||||
* @return [HashSet]<[Constructor]>
|
||||
* @return [MutableList]<[Constructor]>
|
||||
* @throws IllegalStateException 如果未设置任何条件或 [ConstructorRulesData.paramTypes] 目标类不存在
|
||||
* @throws NoSuchMethodError 如果找不到 [Constructor]
|
||||
*/
|
||||
internal fun findConstructors(classSet: Class<*>?, rulesData: ConstructorRulesData) = rulesData.createResult {
|
||||
if (classSet == null) return@createResult hashSetOf()
|
||||
if (classSet == null) return@createResult mutableListOf()
|
||||
paramTypes?.takeIf { it.isNotEmpty() }
|
||||
?.forEachIndexed { p, it -> if (it == UndefinedType) error("Constructor match paramType[$p] class is not found") }
|
||||
hashSetOf<Constructor<*>>().also { constructors ->
|
||||
mutableListOf<Constructor<*>>().also { constructors ->
|
||||
classSet.existConstructors?.also { declares ->
|
||||
var iParamTypes = -1
|
||||
var iParamTypesCds = -1
|
||||
|
Reference in New Issue
Block a user