mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Modify change code note in FieldFinder, MethodFinder, ConstructorFinder
This commit is contained in:
@@ -20,7 +20,7 @@ class ConstructorFinder internal constructor(override val hookInstance: YukiMemb
|
||||
|
||||
> `Constructor` 查找类。
|
||||
|
||||
可通过指定类型查找指定构造方法或一组构造方法。
|
||||
可通过指定类型查找指定 `Constructor` 或一组 `Constructor`。
|
||||
|
||||
### paramCount *- field*
|
||||
|
||||
@@ -414,7 +414,7 @@ fun get(): Instance
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过获得方法所在实例来执行构造方法创建新的实例对象。
|
||||
你可以通过获得方法所在实例来执行 `Constructor` 创建新的实例对象。
|
||||
|
||||
> 示例如下
|
||||
|
||||
@@ -486,7 +486,7 @@ fun give(): Constructor<*>?
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到构造方法本身。
|
||||
> 得到 `Constructor` 本身。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class FieldFinder internal constructor(override val hookInstance: YukiMemberHook
|
||||
|
||||
> `Field` 查找类。
|
||||
|
||||
可通过指定类型查找指定变量或一组变量。
|
||||
可通过指定类型查找指定 `Field` 或一组 `Field`。
|
||||
|
||||
### ~~classSet *- field*~~ <!-- {docsify-ignore} -->
|
||||
|
||||
@@ -357,7 +357,7 @@ fun all(instance: Any?): ArrayList<Instance>
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其变量所在实例用法与 `get` 相同。
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。
|
||||
|
||||
> 示例如下
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class MethodFinder internal constructor(override val hookInstance: YukiMemberHoo
|
||||
|
||||
> `Method` 查找类。
|
||||
|
||||
可通过指定类型查找指定方法或一组方法。
|
||||
可通过指定类型查找指定 `Method` 或一组 `Method`。
|
||||
|
||||
### name *- field*
|
||||
|
||||
@@ -516,7 +516,7 @@ fun get(instance: Any?): Instance
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过获得方法所在实例来执行方法。
|
||||
你可以通过获得方法所在实例来执行 `Method`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
@@ -759,7 +759,7 @@ fun original(): Instance
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 标识需要调用当前 `Method` 未经 Hook 的原始方法。
|
||||
> 标识需要调用当前 `Method` 未经 Hook 的原始 `Method`。
|
||||
|
||||
若当前 `Method` 并未 Hook 则会使用原始的 `Method.invoke` 方法调用。
|
||||
|
||||
@@ -777,7 +777,7 @@ fun call(vararg param: Any?): Any?
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,不指定返回值类型。
|
||||
> 执行 `Method`,不指定返回值类型。
|
||||
|
||||
##### invoke *- method*
|
||||
|
||||
@@ -791,7 +791,7 @@ fun <T> invoke(vararg param: Any?): T?
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 `T` 返回值类型。
|
||||
> 执行 `Method`,指定 `T` 返回值类型。
|
||||
|
||||
##### byte *- method*
|
||||
|
||||
@@ -805,7 +805,7 @@ fun byte(vararg param: Any?): Byte?
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Byte 返回值类型。
|
||||
> 执行 `Method`,指定 Byte 返回值类型。
|
||||
|
||||
##### int *- method*
|
||||
|
||||
@@ -823,7 +823,7 @@ fun int(vararg param: Any?): Int
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Int 返回值类型。
|
||||
> 执行 `Method`,指定 Int 返回值类型。
|
||||
|
||||
##### long *- method*
|
||||
|
||||
@@ -841,7 +841,7 @@ fun long(vararg param: Any?): Long
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Long 返回值类型。
|
||||
> 执行 `Method`,指定 Long 返回值类型。
|
||||
|
||||
##### short *- method*
|
||||
|
||||
@@ -859,7 +859,7 @@ fun short(vararg param: Any?): Short
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Short 返回值类型。
|
||||
> 执行 `Method`,指定 Short 返回值类型。
|
||||
|
||||
##### double *- method*
|
||||
|
||||
@@ -877,7 +877,7 @@ fun double(vararg param: Any?): Double
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Double 返回值类型。
|
||||
> 执行 `Method`,指定 Double 返回值类型。
|
||||
|
||||
##### float *- method*
|
||||
|
||||
@@ -895,7 +895,7 @@ fun float(vararg param: Any?): Float
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Float 返回值类型。
|
||||
> 执行 `Method`,指定 Float 返回值类型。
|
||||
|
||||
##### string *- method*
|
||||
|
||||
@@ -913,7 +913,7 @@ fun string(vararg param: Any?): String
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 String 返回值类型。
|
||||
> 执行 `Method`,指定 String 返回值类型。
|
||||
|
||||
##### char *- method*
|
||||
|
||||
@@ -927,7 +927,7 @@ fun char(vararg param: Any?): Char
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Char 返回值类型。
|
||||
> 执行 `Method`,指定 Char 返回值类型。
|
||||
|
||||
##### boolean *- method*
|
||||
|
||||
@@ -945,7 +945,7 @@ fun boolean(vararg param: Any?): Boolean
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Boolean 返回值类型。
|
||||
> 执行 `Method`,指定 Boolean 返回值类型。
|
||||
|
||||
#### array *- method*
|
||||
|
||||
@@ -959,7 +959,7 @@ inline fun <reified T> array(vararg param: Any?): Array<T>
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 Array 返回值类型。
|
||||
> 执行 `Method`,指定 Array 返回值类型。
|
||||
|
||||
#### list *- method*
|
||||
|
||||
@@ -973,4 +973,4 @@ inline fun <reified T> list(vararg param: Any?): List<T>
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行方法,指定 List 返回值类型。
|
||||
> 执行 `Method`,指定 List 返回值类型。
|
@@ -50,7 +50,7 @@ import java.lang.reflect.Member
|
||||
/**
|
||||
* [Constructor] 查找类
|
||||
*
|
||||
* 可通过指定类型查找指定构造方法或一组构造方法
|
||||
* 可通过指定类型查找指定 [Constructor] 或一组 [Constructor]
|
||||
* @param hookInstance 当前 Hook 实例 - 填写后将自动设置 [YukiMemberHookCreator.MemberHookCreator.members]
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@@ -171,9 +171,9 @@ class ConstructorFinder @PublishedApi internal constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到构造方法或一组构造方法
|
||||
* 得到 [Constructor] 或一组 [Constructor]
|
||||
* @return [HashSet]<[Constructor]>
|
||||
* @throws NoSuchMethodError 如果找不到构造方法
|
||||
* @throws NoSuchMethodError 如果找不到 [Constructor]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findConstructors(usedClassSet, orderIndex, matchIndex, rulesData)
|
||||
|
||||
@@ -312,7 +312,7 @@ class ConstructorFinder @PublishedApi internal constructor(
|
||||
|
||||
/**
|
||||
* [Constructor] 查找结果处理类 - 为 [hookInstance] 提供
|
||||
* @param isNoSuch 是否没有找到构造方法 - 默认否
|
||||
* @param isNoSuch 是否没有找到 [Constructor] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
inner class Process internal constructor(
|
||||
@@ -374,7 +374,7 @@ class ConstructorFinder @PublishedApi internal constructor(
|
||||
|
||||
/**
|
||||
* [Constructor] 查找结果实现类
|
||||
* @param isNoSuch 是否没有找到构造方法 - 默认否
|
||||
* @param isNoSuch 是否没有找到 [Constructor] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
inner class Result internal constructor(
|
||||
@@ -526,21 +526,21 @@ class ConstructorFinder @PublishedApi internal constructor(
|
||||
|
||||
/**
|
||||
* 执行 [Constructor] 创建目标实例
|
||||
* @param param 构造方法参数
|
||||
* @param param [Constructor] 参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
private fun baseCall(vararg param: Any?) = constructor?.newInstance(*param)
|
||||
|
||||
/**
|
||||
* 执行 [Constructor] 创建目标实例 - 不指定目标实例类型
|
||||
* @param param 构造方法参数
|
||||
* @param param [Constructor] 参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
fun call(vararg param: Any?) = baseCall(*param)
|
||||
|
||||
/**
|
||||
* 执行 [Constructor] 创建目标实例 - 指定 [T] 目标实例类型
|
||||
* @param param 构造方法参数
|
||||
* @param param [Constructor] 参数
|
||||
* @return [T] or null
|
||||
*/
|
||||
fun <T> newInstance(vararg param: Any?) = baseCall(*param) as? T?
|
||||
|
@@ -49,9 +49,9 @@ import com.highcapable.yukihookapi.hook.utils.runBlocking
|
||||
import java.lang.reflect.Field
|
||||
|
||||
/**
|
||||
* Field 查找类
|
||||
* [Field] 查找类
|
||||
*
|
||||
* 可通过指定类型查找指定变量或一组变量
|
||||
* 可通过指定类型查找指定 [Field] 或一组 [Field]
|
||||
* @param hookInstance 当前 Hook 实例
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@@ -172,9 +172,9 @@ class FieldFinder @PublishedApi internal constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到变量或一组变量
|
||||
* 得到 [Field] 或一组 [Field]
|
||||
* @return [HashSet]<[Field]>
|
||||
* @throws NoSuchFieldError 如果找不到变量
|
||||
* @throws NoSuchFieldError 如果找不到 [Field]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findFields(usedClassSet, orderIndex, matchIndex, rulesData)
|
||||
|
||||
@@ -292,7 +292,7 @@ class FieldFinder @PublishedApi internal constructor(
|
||||
/**
|
||||
* [Field] 查找结果实现类
|
||||
*
|
||||
* @param isNoSuch 是否没有找到变量 - 默认否
|
||||
* @param isNoSuch 是否没有找到 [Field] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
inner class Result internal constructor(
|
||||
@@ -317,7 +317,7 @@ class FieldFinder @PublishedApi internal constructor(
|
||||
* - ❗如果目标对象不是静态 - 你必须设置 [instance]
|
||||
*
|
||||
* - ❗若你设置了 [remedys] 请使用 [wait] 回调结果方法
|
||||
* @param instance 变量所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @param instance [Field] 所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @return [Instance]
|
||||
*/
|
||||
fun get(instance: Any? = null) = Instance(instance, give())
|
||||
@@ -332,7 +332,7 @@ class FieldFinder @PublishedApi internal constructor(
|
||||
* - ❗如果目标对象不是静态 - 你必须设置 [instance]
|
||||
*
|
||||
* - ❗若你设置了 [remedys] 请使用 [waitAll] 回调结果方法
|
||||
* @param instance 变量所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @param instance [Field] 所在的实例对象 - 如果是静态可不填 - 默认 null
|
||||
* @return [ArrayList]<[Instance]>
|
||||
*/
|
||||
fun all(instance: Any? = null) =
|
||||
|
@@ -52,7 +52,7 @@ import java.lang.reflect.Method
|
||||
/**
|
||||
* [Method] 查找类
|
||||
*
|
||||
* 可通过指定类型查找指定方法或一组方法
|
||||
* 可通过指定类型查找指定 [Method] 或一组 [Method]
|
||||
* @param hookInstance 当前 Hook 实例 - 填写后将自动设置 [YukiMemberHookCreator.MemberHookCreator.members]
|
||||
* @param classSet 当前需要查找的 [Class] 实例
|
||||
*/
|
||||
@@ -243,9 +243,9 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到方法或一组方法
|
||||
* 得到 [Method] 或一组 [Method]
|
||||
* @return [HashSet]<[Method]>
|
||||
* @throws NoSuchMethodError 如果找不到方法
|
||||
* @throws NoSuchMethodError 如果找不到 [Method]
|
||||
*/
|
||||
private val result get() = ReflectionTool.findMethods(usedClassSet, orderIndex, matchIndex, rulesData)
|
||||
|
||||
@@ -385,7 +385,7 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
|
||||
/**
|
||||
* [Method] 查找结果处理类 - 为 [hookInstance] 提供
|
||||
* @param isNoSuch 是否没有找到方法 - 默认否
|
||||
* @param isNoSuch 是否没有找 [Method] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
inner class Process internal constructor(
|
||||
@@ -447,7 +447,7 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
|
||||
/**
|
||||
* [Method] 查找结果实现类
|
||||
* @param isNoSuch 是否没有找到方法 - 默认否
|
||||
* @param isNoSuch 是否没有找到 [Method] - 默认否
|
||||
* @param throwable 错误信息
|
||||
*/
|
||||
inner class Result internal constructor(
|
||||
@@ -607,7 +607,7 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
private var isCallOriginal = false
|
||||
|
||||
/**
|
||||
* 标识需要调用当前 [Method] 未经 Hook 的原始方法
|
||||
* 标识需要调用当前 [Method] 未经 Hook 的原始 [Method]
|
||||
*
|
||||
* 若当前 [Method] 并未 Hook 则会使用原始的 [Method.invoke] 方法调用
|
||||
*
|
||||
@@ -620,7 +620,7 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行方法
|
||||
* 执行 [Method]
|
||||
* @param param 方法参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
@@ -630,21 +630,21 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
else method?.invoke(instance, *param)
|
||||
|
||||
/**
|
||||
* 执行方法 - 不指定返回值类型
|
||||
* 执行 [Method] - 不指定返回值类型
|
||||
* @param param 方法参数
|
||||
* @return [Any] or null
|
||||
*/
|
||||
fun call(vararg param: Any?) = baseCall(*param)
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [T] 返回值类型
|
||||
* 执行 [Method] - 指定 [T] 返回值类型
|
||||
* @param param 方法参数
|
||||
* @return [T] or null
|
||||
*/
|
||||
fun <T> invoke(vararg param: Any?) = baseCall(*param) as? T?
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Byte] 返回值类型
|
||||
* 执行 [Method] - 指定 [Byte] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标变量的类型 - 发生错误会返回 null
|
||||
* @param param 方法参数
|
||||
@@ -653,85 +653,85 @@ class MethodFinder @PublishedApi internal constructor(
|
||||
fun byte(vararg param: Any?) = invoke<Byte?>(*param)
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Int] 返回值类型
|
||||
* 执行 [Method] - 指定 [Int] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Int] 取不到返回 0
|
||||
*/
|
||||
fun int(vararg param: Any?) = invoke(*param) ?: 0
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Long] 返回值类型
|
||||
* 执行 [Method] - 指定 [Long] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Long] 取不到返回 0L
|
||||
*/
|
||||
fun long(vararg param: Any?) = invoke(*param) ?: 0L
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Short] 返回值类型
|
||||
* 执行 [Method] - 指定 [Short] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Short] 取不到返回 0
|
||||
*/
|
||||
fun short(vararg param: Any?) = invoke<Short?>(*param) ?: 0
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Double] 返回值类型
|
||||
* 执行 [Method] - 指定 [Double] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Double] 取不到返回 0.0
|
||||
*/
|
||||
fun double(vararg param: Any?) = invoke(*param) ?: 0.0
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Float] 返回值类型
|
||||
* 执行 [Method] - 指定 [Float] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Float] 取不到返回 0f
|
||||
*/
|
||||
fun float(vararg param: Any?) = invoke(*param) ?: 0f
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [String] 返回值类型
|
||||
* 执行 [Method] - 指定 [String] 返回值类型
|
||||
* @param param 方法参数
|
||||
* @return [String] 取不到返回 ""
|
||||
*/
|
||||
fun string(vararg param: Any?) = invoke(*param) ?: ""
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Char] 返回值类型
|
||||
* 执行 [Method] - 指定 [Char] 返回值类型
|
||||
* @param param 方法参数
|
||||
* @return [Char] 取不到返回 ' '
|
||||
*/
|
||||
fun char(vararg param: Any?) = invoke(*param) ?: ' '
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Boolean] 返回值类型
|
||||
* 执行 [Method] - 指定 [Boolean] 返回值类型
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回默认值
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回默认值
|
||||
* @param param 方法参数
|
||||
* @return [Boolean] 取不到返回 false
|
||||
*/
|
||||
fun boolean(vararg param: Any?) = invoke(*param) ?: false
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [Array] 返回值类型 - 每项类型 [T]
|
||||
* 执行 [Method] - 指定 [Array] 返回值类型 - 每项类型 [T]
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回空数组
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回空数组
|
||||
* @return [Array] 取不到返回空数组
|
||||
*/
|
||||
inline fun <reified T> array(vararg param: Any?) = invoke(*param) ?: arrayOf<T>()
|
||||
|
||||
/**
|
||||
* 执行方法 - 指定 [List] 返回值类型 - 每项类型 [T]
|
||||
* 执行 [Method] - 指定 [List] 返回值类型 - 每项类型 [T]
|
||||
*
|
||||
* - ❗请确认目标方法的返回值 - 发生错误会返回空数组
|
||||
* - ❗请确认目标 [Method] 的返回值 - 发生错误会返回空数组
|
||||
* @return [List] 取不到返回空数组
|
||||
*/
|
||||
inline fun <reified T> list(vararg param: Any?) = invoke(*param) ?: listOf<T>()
|
||||
|
Reference in New Issue
Block a user