mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-06 02:35:40 +08:00
refactor: merge HashSet, ArrayList to MutableList
This commit is contained in:
@@ -626,20 +626,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
@@ -686,20 +690,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
`result` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将回调空的 `MutableList`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
|
@@ -267,13 +267,17 @@ 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**
|
||||
|
||||
`v1.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -398,13 +402,17 @@ constructor {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
fun all(): MutableList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
@@ -446,20 +454,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -488,13 +500,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -253,13 +253,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)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -368,13 +372,17 @@ 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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
@@ -416,20 +424,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -458,13 +470,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -403,13 +403,17 @@ 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**
|
||||
|
||||
`v1.0.0` `first`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -520,13 +524,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Method` 实例处理类数组。
|
||||
@@ -568,20 +576,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Method` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -610,13 +622,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.0.0` `first`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -618,20 +618,24 @@ fun get(): Class<*>?
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashSet<Class<*>>
|
||||
fun all(): MutableList<Class<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
@@ -678,20 +682,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`result` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将回调空的 `MutableList`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
|
@@ -259,13 +259,17 @@ 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)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -390,13 +394,17 @@ constructor {
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
fun all(): MutableList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
@@ -438,20 +446,24 @@ fun give(): Constructor<*>?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Constructor<*>>
|
||||
fun giveAll(): MutableList<Constructor<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -480,13 +492,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -245,13 +245,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -360,13 +364,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
@@ -408,20 +416,24 @@ fun give(): Field?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Field>
|
||||
fun giveAll(): MutableList<Field>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -450,13 +462,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
@@ -395,13 +395,17 @@ 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)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`initiate` 类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
@@ -512,13 +516,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `ArrayList` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类数组。
|
||||
@@ -560,20 +568,24 @@ fun give(): Method?
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Method>
|
||||
fun giveAll(): MutableList<Method>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
返回值类型由 `HashSet` 修改为 `MutableList`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Method` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
@@ -602,13 +614,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.0.0` `添加`
|
||||
|
||||
`v1.0.3` `修改`
|
||||
|
||||
`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
|
||||
|
@@ -58,28 +58,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) } } }
|
||||
|
||||
/**
|
||||
* 将目标类型转换为可识别的兼容类型
|
||||
|
@@ -427,27 +427,27 @@ 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<*>> =
|
||||
if (async && name.isNotBlank()) hashSetOf<Class<*>>().also { classes ->
|
||||
private fun readFromCache(): MutableList<Class<*>> =
|
||||
if (async && name.isNotBlank()) mutableListOf<Class<*>>().also { classes ->
|
||||
context?.currentSp()?.getStringSet(name, emptySet())?.takeIf { it.isNotEmpty() }
|
||||
?.forEach { className -> if (className.hasClass(loaderSet)) classes.add(className.toClass(loaderSet)) }
|
||||
} else hashSetOf()
|
||||
} 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) }
|
||||
context?.also {
|
||||
if (it.packageName == "android") error("Cannot create classes cache for \"android\", please remove \"name\" param")
|
||||
@@ -460,7 +460,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) }
|
||||
}
|
||||
@@ -505,7 +505,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
|
||||
@@ -534,10 +534,10 @@ class DexClassFinder internal constructor(
|
||||
*
|
||||
* - 返回全部查找条件匹配的多个 [Class] 实例
|
||||
*
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [HashSet]
|
||||
* - 在查找条件找不到任何结果的时候将返回空的 [MutableList]
|
||||
*
|
||||
* - 若你设置了 [async] 请使用 [waitAll] 方法
|
||||
* @return [HashSet]<[Class]>
|
||||
* @return [MutableList]<[Class]>
|
||||
*/
|
||||
fun all() = classInstances
|
||||
|
||||
@@ -578,13 +578,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
|
||||
}
|
||||
|
@@ -40,9 +40,9 @@ import com.highcapable.yukireflection.finder.type.factory.ConstructorConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.CountConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.type.defined.UndefinedType
|
||||
import com.highcapable.yukireflection.type.defined.VagueType
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.utils.factory.runBlocking
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
@@ -225,7 +225,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) }
|
||||
@@ -234,7 +234,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() }?.forEach { memberInstances.add(it) }
|
||||
}
|
||||
@@ -267,7 +267,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]
|
||||
@@ -315,13 +315,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
|
||||
}
|
||||
}
|
||||
@@ -364,9 +364,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] 本身
|
||||
@@ -383,10 +383,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] 实例处理类
|
||||
@@ -411,9 +411,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()) }
|
||||
}
|
||||
|
@@ -183,7 +183,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)
|
||||
@@ -192,7 +192,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) }
|
||||
}
|
||||
@@ -225,7 +225,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]
|
||||
@@ -273,13 +273,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
|
||||
}
|
||||
}
|
||||
@@ -329,10 +329,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] 本身
|
||||
@@ -349,10 +349,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] 实例处理类
|
||||
@@ -379,9 +379,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)) }
|
||||
}
|
||||
|
@@ -42,9 +42,9 @@ import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.NameConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
|
||||
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.type.defined.UndefinedType
|
||||
import com.highcapable.yukireflection.type.defined.VagueType
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.utils.factory.runBlocking
|
||||
import java.lang.reflect.Method
|
||||
|
||||
@@ -317,7 +317,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)
|
||||
@@ -326,7 +326,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() }?.forEach { memberInstances.add(it) }
|
||||
}
|
||||
@@ -359,7 +359,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 = mutableListOf<Pair<MethodFinder, Result>>()
|
||||
|
||||
/**
|
||||
* 创建需要重新查找的 [Method]
|
||||
@@ -407,13 +407,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
|
||||
}
|
||||
}
|
||||
@@ -458,10 +458,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] 本身
|
||||
@@ -478,10 +478,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] 实例处理类
|
||||
@@ -508,9 +508,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)) }
|
||||
}
|
||||
|
@@ -43,13 +43,13 @@ import com.highcapable.yukireflection.finder.members.data.ConstructorRulesData
|
||||
import com.highcapable.yukireflection.finder.members.data.FieldRulesData
|
||||
import com.highcapable.yukireflection.finder.members.data.MemberRulesData
|
||||
import com.highcapable.yukireflection.finder.members.data.MethodRulesData
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.type.defined.UndefinedType
|
||||
import com.highcapable.yukireflection.type.defined.VagueType
|
||||
import com.highcapable.yukireflection.type.java.DalvikBaseDexClassLoader
|
||||
import com.highcapable.yukireflection.type.java.NoClassDefFoundErrorClass
|
||||
import com.highcapable.yukireflection.type.java.NoSuchFieldErrorClass
|
||||
import com.highcapable.yukireflection.type.java.NoSuchMethodErrorClass
|
||||
import com.highcapable.yukireflection.log.YLog
|
||||
import com.highcapable.yukireflection.utils.factory.conditions
|
||||
import com.highcapable.yukireflection.utils.factory.findLastIndex
|
||||
import com.highcapable.yukireflection.utils.factory.lastIndex
|
||||
@@ -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