mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-06 02:35:40 +08:00
Modify change CurrentClass constructor param names
This commit is contained in:
@@ -34,10 +34,10 @@ import com.highcapable.yukihookapi.hook.factory.method
|
||||
|
||||
/**
|
||||
* 当前实例的类操作对象
|
||||
* @param instance 当前实例的 [Class]
|
||||
* @param self 当前实例本身
|
||||
* @param classSet 当前实例的 [Class]
|
||||
* @param instance 当前实例本身
|
||||
*/
|
||||
class CurrentClass @PublishedApi internal constructor(@PublishedApi internal val instance: Class<*>, @PublishedApi internal val self: Any) {
|
||||
class CurrentClass @PublishedApi internal constructor(@PublishedApi internal val classSet: Class<*>, @PublishedApi internal val instance: Any) {
|
||||
|
||||
/**
|
||||
* 调用父类实例
|
||||
@@ -50,14 +50,14 @@ class CurrentClass @PublishedApi internal constructor(@PublishedApi internal val
|
||||
* @param initiate 查找方法体
|
||||
* @return [FieldFinder.Result.Instance]
|
||||
*/
|
||||
inline fun field(initiate: FieldFinder.() -> Unit) = instance.field(initiate).get(self)
|
||||
inline fun field(initiate: FieldFinder.() -> Unit) = classSet.field(initiate).get(instance)
|
||||
|
||||
/**
|
||||
* 调用当前实例中的方法
|
||||
* @param initiate 查找方法体
|
||||
* @return [MethodFinder.Result.Instance]
|
||||
*/
|
||||
inline fun method(initiate: MethodFinder.() -> Unit) = instance.method(initiate).get(self)
|
||||
inline fun method(initiate: MethodFinder.() -> Unit) = classSet.method(initiate).get(instance)
|
||||
|
||||
/**
|
||||
* 当前类的父类实例的类操作对象
|
||||
@@ -71,13 +71,13 @@ class CurrentClass @PublishedApi internal constructor(@PublishedApi internal val
|
||||
* @param initiate 查找方法体
|
||||
* @return [FieldFinder.Result.Instance]
|
||||
*/
|
||||
inline fun field(initiate: FieldFinder.() -> Unit) = instance.superclass.field(initiate).get(self)
|
||||
inline fun field(initiate: FieldFinder.() -> Unit) = classSet.superclass.field(initiate).get(instance)
|
||||
|
||||
/**
|
||||
* 调用父类实例中的方法
|
||||
* @param initiate 查找方法体
|
||||
* @return [MethodFinder.Result.Instance]
|
||||
*/
|
||||
inline fun method(initiate: MethodFinder.() -> Unit) = instance.superclass.method(initiate).get(self)
|
||||
inline fun method(initiate: MethodFinder.() -> Unit) = classSet.superclass.method(initiate).get(instance)
|
||||
}
|
||||
}
|
@@ -148,7 +148,7 @@ inline fun Class<*>.constructor(initiate: ConstructorFinder.() -> Unit = { empty
|
||||
*/
|
||||
inline fun <reified T : Any> T.current(initiate: CurrentClass.() -> Unit): T {
|
||||
if (javaClass.name == CurrentClass::class.java.name) error("Cannot create itself within CurrentClass itself")
|
||||
CurrentClass(javaClass, self = this).apply(initiate)
|
||||
CurrentClass(javaClass, instance = this).apply(initiate)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ inline fun <reified T : Any> T.current(initiate: CurrentClass.() -> Unit): T {
|
||||
*/
|
||||
inline fun <reified T : Any> T.current(): CurrentClass {
|
||||
if (javaClass.name == CurrentClass::class.java.name) error("Cannot create itself within CurrentClass itself")
|
||||
return CurrentClass(javaClass, self = this)
|
||||
return CurrentClass(javaClass, instance = this)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user