@@ -44,7 +44,7 @@ MyClass::class.resolve().firstMethod {
4444 parameters(String ::class )
4545}.of(myClass).invoke(" Hello, KavaRef!" )
4646// Direct reference to instance.
47- myClass.resolve ().firstMethod {
47+ myClass.asResolver ().firstMethod {
4848 name = " myMethod"
4949 parameters(String ::class )
5050}.invoke(" Hello, KavaRef!" )
@@ -76,6 +76,9 @@ myClass.current().method {
7676` KavaRef ` starts reflection at any time, you need to use ` resolve() ` to create a reflection scope.
7777You no longer directly extend the related ` method ` and ` constructor ` methods to avoid contaminating their scope.
7878
79+ ` KavaRef ` provides the ` asResolver() ` method to directly reference the reflection scope of the instance object,
80+ avoiding contamination caused by the creation of uncontrollable instance objects by the ` current() ` method in ` YukiReflection ` .
81+
7982` KavaRef ` abandons the "Finder" design concept and uses the "Filter" design concept to obtain reflected results.
8083"Find" is no longer a finding, but a "filtering".
8184
@@ -161,8 +164,7 @@ corresponding type when `of(instance)` and `create(...)`, and type checking will
161164// Assume that's your MyClass instance.
162165val myClass: MyClass
163166// Using KavaRef to call and execute.
164- MyClass ::class
165- .resolve()
167+ MyClass ::class .resolve()
166168 .firstMethod {
167169 name = " myMethod"
168170 parameters(String ::class )
@@ -180,7 +182,7 @@ MyClass::class
180182The following functionality is provided in ` YukiReflection ` but is not implemented and no longer provided in ` KavaRef ` :
181183
182184- Preset reflection type constant classes, such as ` StringClass ` , ` IntType ` , etc
183- - You can use Kotlin class references such as ` String::class ` , ` Int::class ` , etc. to replace it.
185+ - You can use Kotlin class references such as ` String::class ` , ` Int::class ` , etc. to instead it.
184186 For primitive types and wrapper classes, ` IntType ` is equivalent to ` Int::class ` , and ` IntClass ` is equivalent to ` JInteger::class `
185187
186188- ` DexClassFinder ` function
@@ -204,7 +206,7 @@ The following functionality is provided in `YukiReflection` but is not implement
204206 - There is conceptual confusion in functional design and will no longer be provided
205207
206208- ` "com.some.clazz".hasClass(loader) ` function
207- - You can use ` loader.hasClass("com.some.clazz") ` to replace it
209+ - You can use ` loader.hasClass("com.some.clazz") ` to instead it
208210
209211- ` Class.hasField ` , ` Class.hasMethod ` , ` Class.hasConstructor ` functions
210212 - Due to design defects, no longer provided
@@ -216,11 +218,11 @@ The following functionality is provided in `YukiReflection` but is not implement
216218 - If you just want to get generic parameters of the superclass, you can use ` Class.genericSuperclassTypeArguments() ` .
217219 Due to design defects, no longer provided
218220
219- - ` Class .current()` , ` CurrentClass ` functions
220- - Merged into the core function of ` KavaRef.resolve ()` and is no longer provided separately
221+ - ` Any .current()` , ` CurrentClass ` functions
222+ - You can use ` Any.asResolver ()` to instead it
221223
222224- ` Class.buildOf(...) ` function
223- - You can use ` Class.createInstance(...) ` to replace it
225+ - You can use ` Class.createInstance(...) ` to instead it
224226
225227- ` Class.allMethods() ` , ` Class.allFields() ` , ` Class.allConstructors() ` functions
226228 - Due to its pollution scope, no longer provided
@@ -240,8 +242,7 @@ When no valid members are filtered, `KavaRef` will throw an exception directly u
240242// Assume that's your MyClass instance.
241243val myClass: MyClass
242244// Using KavaRef to call and execute.
243- MyClass ::class
244- .resolve()
245+ MyClass ::class .resolve()
245246 .optional() // Declare as optional, do not throw exceptions.
246247 // Use firstMethodOrNull instead of firstMethod,
247248 // because the NoSuchElementException of Kotlin itself will be thrown.
0 commit comments