mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-10 12:34:06 +08:00
Initial commit
This commit is contained in:
33
docs-source/src/zh-cn/about/about.md
Normal file
33
docs-source/src/zh-cn/about/about.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 关于此文档
|
||||
|
||||
> 此文档由 [VuePress](https://v2.vuepress.vuejs.org/zh) 强力驱动。
|
||||
|
||||
## License
|
||||
|
||||
[The MIT License (MIT)](https://github.com/fankes/YukiReflection/blob/master/LICENSE)
|
||||
|
||||
```:no-line-numbers
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2019-2023 HighCapable
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
版权所有 © 2019-2023 HighCapable
|
13
docs-source/src/zh-cn/about/changelog.md
Normal file
13
docs-source/src/zh-cn/about/changelog.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# 更新日志
|
||||
|
||||
> 这里记录了 `YukiReflection` 的版本更新历史。
|
||||
|
||||
::: danger
|
||||
|
||||
我们只会对最新的 API 版本进行维护,若你正在使用过时的 API 版本则代表你自愿放弃一切维护的可能性。
|
||||
|
||||
:::
|
||||
|
||||
### 1.0.0 | 2023.01.26  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
11
docs-source/src/zh-cn/about/contacts.md
Normal file
11
docs-source/src/zh-cn/about/contacts.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 联系我们
|
||||
|
||||
> 如在使用中有任何问题,或有任何建设性的建议,都可以联系我们。
|
||||
|
||||
加入我们 [点击加入 Telegram 群组](https://t.me/YukiReflection)
|
||||
|
||||
在 **酷安** 找到我 [@星夜不荟](http://www.coolapk.com/u/876977)
|
||||
|
||||
## 助力维护
|
||||
|
||||
感谢您选择并使用 `YukiReflection`,如有代码相关的建议和请求,可在 Github 提交 Pull Request。
|
104
docs-source/src/zh-cn/about/future.md
Normal file
104
docs-source/src/zh-cn/about/future.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# 展望未来
|
||||
|
||||
> 未来是美好的,也是不确定的,让我们共同期待 `YukiReflection` 在未来的发展空间。
|
||||
|
||||
## 未来的计划
|
||||
|
||||
> 这里收录了 `YukiReflection` 可能会在后期添加的功能。
|
||||
|
||||
### 自动生成反射代码
|
||||
|
||||
使用 `stub` 的方式创建一个 `Kotlin` 类,并声明其中的参数,以及其在各个版本中的不同状态。
|
||||
|
||||
比如下面的这个 `Java` 类就是我们需要反射的目标类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```java:no-line-numbers
|
||||
package com.example.test;
|
||||
|
||||
public class MyClass {
|
||||
|
||||
private String myField = "test";
|
||||
|
||||
public MyClass() {
|
||||
// ...
|
||||
}
|
||||
|
||||
private String myMethod1(String var1, int var2) {
|
||||
// ...
|
||||
}
|
||||
|
||||
private void myMethod2() {
|
||||
// ...
|
||||
}
|
||||
|
||||
private void myMethod3(String var1) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
通过目前 API 的现有用法可以使用如下方式反射调用这个类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
classOf<MyClass>().buildOf().current {
|
||||
// 调用 myField
|
||||
val value = field { name = "myField" }.string()
|
||||
// 调用 myMethod1
|
||||
val methodValue = method { name = "myMethod1" }.string("test", 0)
|
||||
// 调用 myMethod2
|
||||
method { name = "myMethod2" }.call()
|
||||
// 调用 myMethod3
|
||||
method { name = "myMethod3" }.call("test")
|
||||
}
|
||||
```
|
||||
|
||||
目前要实现的功能是可以使用反射功能直接定义为如下 `Kotlin` 类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
package com.example.test
|
||||
|
||||
@ReflectClass
|
||||
class MyClass {
|
||||
|
||||
@ReflectField
|
||||
val myField: String = fieldValueOf("none")
|
||||
|
||||
@ReflectMethod
|
||||
fun myMethod1(var1: String, var2: Int): String = methodReturnValueOf("none")
|
||||
|
||||
@ReflectMethod
|
||||
fun myMethod2() = MethodReturnType.Unit
|
||||
|
||||
@ReflectMethod
|
||||
fun myMethod3(var1: String) = MethodReturnType.Unit
|
||||
}
|
||||
```
|
||||
|
||||
然后我们就可以直接调用这个定义好的 `Kotlin` 类来实现反射功能,API 会根据注解自动生成反射代码。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
MyClass().also {
|
||||
// 调用 myField
|
||||
val value = it.myField
|
||||
// 调用 myMethod1
|
||||
val methodValue = it.myMethod1("test", 0)
|
||||
// 调用 myMethod2
|
||||
it.myMethod2()
|
||||
// 调用 myMethod3
|
||||
it.myMethod3("test")
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
|
||||
以上功能可能会在实际推出后有所变化,最终以实际版本的功能为准。
|
||||
|
||||
:::
|
1698
docs-source/src/zh-cn/api/features.md
Normal file
1698
docs-source/src/zh-cn/api/features.md
Normal file
File diff suppressed because it is too large
Load Diff
55
docs-source/src/zh-cn/api/home.md
Normal file
55
docs-source/src/zh-cn/api/home.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
next:
|
||||
text: Public API
|
||||
link: /zh-cn/api/public/com/highcapable/yukireflection/YukiReflection
|
||||
---
|
||||
|
||||
# 文档介绍
|
||||
|
||||
> 这里的文档将同步最新 API 版本的相关用法,请保持 `YukiReflection` 为最新版本以使用最新版本的功能。
|
||||
|
||||
## 功能描述说明
|
||||
|
||||
> 功能描述主要介绍当前 API 的相关用法和用途。
|
||||
|
||||
## 功能示例说明
|
||||
|
||||
> 功能示例主要展示了当前 API 的基本用法示例,可供参考。
|
||||
|
||||
## 变更记录说明
|
||||
|
||||
首个版本的功能将标记为 `v<version>` `添加`;
|
||||
|
||||
后期新增加的功能将标记为 `v<version>` `新增`;
|
||||
|
||||
后期修改的功能将被追加为 `v<version>` `修改`;
|
||||
|
||||
后期被作废的功能将标记为 `v<version>` `作废` 并会标注删除线;
|
||||
|
||||
后期被删除的功能将标记为 `v<version>` `移除` 并会标注删除线。
|
||||
|
||||
## 相关符号说明
|
||||
|
||||
- *kt* Kotlin Static File
|
||||
|
||||
- *annotation* 注解
|
||||
|
||||
- *interface* 接口
|
||||
|
||||
- *object* 类 (单例)
|
||||
|
||||
- *class* 类
|
||||
|
||||
- *field* 变量或 `get`、`set` 方法或只读的 `get` 方法
|
||||
|
||||
- *method* 方法
|
||||
|
||||
- *enum* Enum 常量
|
||||
|
||||
- *ext-field* 扩展的变量 (全局)
|
||||
|
||||
- *ext-method* 扩展的方法 (全局)
|
||||
|
||||
- *i-ext-field* 扩展的变量 (调用域限制)
|
||||
|
||||
- *i-ext-method* 扩展的方法 (调用域限制)
|
@@ -0,0 +1,155 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# YukiReflection <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object YukiReflection
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是 `YukiReflection` 的装载调用类。
|
||||
|
||||
## API_VERSION_NAME <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val API_VERSION_NAME: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获取当前 `YukiReflection` 的版本。
|
||||
|
||||
## API_VERSION_CODE <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val API_VERSION_CODE: Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获取当前 `YukiReflection` 的版本号。
|
||||
|
||||
## Configs <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object Configs
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 对 API 相关功能的配置类。
|
||||
|
||||
### debugTag <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var debugTag: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个调试日志的全局标识。
|
||||
|
||||
默认文案为 `YukiReflection`。
|
||||
|
||||
你可以修改为你自己的文案。
|
||||
|
||||
### isDebug <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isDebug: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否启用 Debug 模式。
|
||||
|
||||
默认不启用,启用后将交由日志输出管理器打印详细日志 (例如反射查找功能的耗时) 到控制台。
|
||||
|
||||
请过滤 `debugTag` 即可找到每条日志。
|
||||
|
||||
### isAllowPrintingLogs <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isAllowPrintingLogs: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否启用调试日志的输出功能。
|
||||
|
||||
::: warning
|
||||
|
||||
关闭后将会停用 **YukiReflection** 对全部日志的输出。
|
||||
|
||||
:::
|
||||
|
||||
### isEnableMemberCache <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableMemberCache: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否启用 `Member` 缓存功能。
|
||||
|
||||
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
|
||||
|
||||
启用后会缓存已经找到的 `Method`、`Constructor`、`Field`。
|
||||
|
||||
缓存的 `Member` 都将处于 `ReflectsCacheStore` 的全局静态实例中。
|
||||
|
||||
推荐使用 `MethodFinder`、`ConstructorFinder`、`FieldFinder` 来获取 `Member`。
|
||||
|
||||
除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。
|
||||
|
||||
## configs <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun configs(initiate: Configs.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 对 `Configs` 类实现了一个 `lambda` 方法体。
|
||||
|
||||
你可以轻松地调用它进行配置。
|
@@ -0,0 +1,221 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# CurrentClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class CurrentClass internal constructor(internal val classSet: Class<*>, internal val instance: Any)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前实例的类操作对象。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `classSet` 的 `Class.getName`。
|
||||
|
||||
## simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val simpleName: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `classSet` 的 `Class.getSimpleName`。
|
||||
|
||||
## generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun generic(): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前实例中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前实例中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(): SuperClass
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 调用父类实例。
|
||||
|
||||
## field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 调用当前实例中的变量。
|
||||
|
||||
## method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 调用当前实例中的方法。
|
||||
|
||||
## SuperClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class SuperClass internal constructor(internal val superClassSet: Class<*>)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前类的父类实例的类操作对象。
|
||||
|
||||
### name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `classSet` 中父类的 `Class.getName`。
|
||||
|
||||
### simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val simpleName: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `classSet` 中父类的 `Class.getSimpleName`。
|
||||
|
||||
### generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun generic(): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前实例父类中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
### generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前实例父类中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
### field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 调用父类实例中的变量。
|
||||
|
||||
### method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 调用父类实例中的方法。
|
@@ -0,0 +1,35 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# GenericClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class GenericClass internal constructor(private val type: ParameterizedType)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 的泛型父类操作对象。
|
||||
|
||||
## argument <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun argument(index: Int): Class<*>
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> argument(index: Int): Class<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得泛型参数数组下标的 `Class` 实例。
|
@@ -0,0 +1,51 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# VariousClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class VariousClass(private vararg val name: String)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个不确定性 `Class` 类名装载器,通过 `name` 装载 `Class` 名称数组。
|
||||
|
||||
## get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(loader: ClassLoader? = null, initialize: Boolean): Class<*>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获取匹配的实体类。
|
||||
|
||||
使用当前 `loader` 装载目标 `Class`。
|
||||
|
||||
## getOrNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getOrNull(loader: ClassLoader? = null, initialize: Boolean): Class<*>?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获取匹配的实体类。
|
||||
|
||||
使用当前 `loader` 装载目标 `Class`。
|
||||
|
||||
匹配不到 `Class` 会返回 `null`,不会抛出异常。
|
@@ -0,0 +1,630 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ReflectionFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是自定义 `Member` 和 `Class` 相关功能的查找匹配以及 `invoke` 的封装类。
|
||||
|
||||
## ClassLoader.listOfClasses <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ClassLoader.listOfClasses(): List<String>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 写出当前 `ClassLoader` 下所有 `Class` 名称数组。
|
||||
|
||||
::: warning
|
||||
|
||||
此方法在 **Class** 数量过多时会非常耗时。
|
||||
|
||||
若要按指定规则查找一个 **Class**,请使用 [ClassLoader.searchClass](#classloader-searchclass-ext-method) 方法。
|
||||
|
||||
:::
|
||||
|
||||
## ClassLoader.searchClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun ClassLoader.searchClass(context: Context?, name: String, async: Boolean, initiate: ClassConditions): DexClassFinder.Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过当前 `ClassLoader` 按指定条件查找并得到 **Dex** 中的 `Class`。
|
||||
|
||||
::: danger
|
||||
|
||||
此方法在 **Class** 数量过多及查找条件复杂时会非常耗时。
|
||||
|
||||
建议启用 **async** 或设置 **name** 参数,**name** 参数将在当前 APP 不同版本中自动进行本地缓存以提升效率。
|
||||
|
||||
如果使用了 **async** 或 **name** 参数,则必须填写 **context** 参数。
|
||||
|
||||
此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
|
||||
|
||||
:::
|
||||
|
||||
## Class.hasExtends <span class="symbol">- ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val Class<*>.hasExtends: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 是否有继承关系,父类是 `Any` 将被认为没有继承关系。
|
||||
|
||||
## Class?.extends <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
infix fun Class<*>?.extends(other: Class<*>?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 是否继承于 `other`。
|
||||
|
||||
如果当前 `Class` 就是 `other` 也会返回 `true`。
|
||||
|
||||
如果当前 `Class` 为 `null` 或 `other` 为 `null` 会返回 `false`。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用此方法来判断两个 `Class` 是否存在继承关系。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 假设下面这两个 Class 就是你需要判断的 Class
|
||||
val classA: Class<*>?
|
||||
val classB: Class<*>?
|
||||
// 判断 A 是否继承于 B
|
||||
if (classA extends classB) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class?.notExtends <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
infix fun Class<*>?.notExtends(other: Class<*>?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 是否不继承于 `other`。
|
||||
|
||||
此方法相当于 `extends` 的反向判断。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用此方法来判断两个 `Class` 是否不存在继承关系。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 假设下面这两个 Class 就是你需要判断的 Class
|
||||
val classA: Class<*>?
|
||||
val classB: Class<*>?
|
||||
// 判断 A 是否不继承于 B
|
||||
if (classA notExtends classB) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class?.implements <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
infix fun Class<*>?.implements(other: Class<*>?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 是否实现了 `other` 接口类。
|
||||
|
||||
如果当前 `Class` 为 `null` 或 `other` 为 `null` 会返回 `false`。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用此方法来判断两个 `Class` 是否存在依赖关系。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 假设下面这两个 Class 就是你需要判断的 Class
|
||||
val classA: Class<*>?
|
||||
val classB: Class<*>?
|
||||
// 判断 A 是否实现了 B 接口类
|
||||
if (classA implements classB) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class?.notImplements <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
infix fun Class<*>?.notImplements(other: Class<*>?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Class` 是否未实现 `other` 接口类。
|
||||
|
||||
此方法相当于 `implements` 的反向判断。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用此方法来判断两个 `Class` 是否不存在依赖关系。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 假设下面这两个 Class 就是你需要判断的 Class
|
||||
val classA: Class<*>?
|
||||
val classB: Class<*>?
|
||||
// 判断 A 是否未实现 B 接口类
|
||||
if (classA notImplements classB) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class.toJavaPrimitiveType <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Class<*>.toJavaPrimitiveType(): Class<*>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 自动转换当前 `Class` 为 Java 原始类型 (Primitive Type)。
|
||||
|
||||
如果当前 `Class` 为 Java 或 Kotlin 基本类型将自动执行类型转换。
|
||||
|
||||
当前能够自动转换的基本类型如下。
|
||||
|
||||
- `kotlin.Unit`
|
||||
- `java.lang.Void`
|
||||
- `java.lang.Boolean`
|
||||
- `java.lang.Integer`
|
||||
- `java.lang.Float`
|
||||
- `java.lang.Double`
|
||||
- `java.lang.Long`
|
||||
- `java.lang.Short`
|
||||
- `java.lang.Character`
|
||||
- `java.lang.Byte`
|
||||
|
||||
## String.toClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClass(loader: ClassLoader?, initialize: Boolean): Class<*>
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> String.toClass(loader: ClassLoader?, initialize: Boolean): Class<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过字符串类名转换为 `loader` 中的实体类。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以直接填写你要查找的目标 `Class`,必须在默认 `ClassLoader` 下存在。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
"com.example.demo.DemoClass".toClass()
|
||||
```
|
||||
|
||||
你还可以自定义 `Class` 所在的 `ClassLoader`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
"com.example.demo.DemoClass".toClass(customClassLoader)
|
||||
```
|
||||
|
||||
你还可以指定 `Class` 的目标类型。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 指定的 DemoClass 必须存在或为可访问的 stub
|
||||
"com.example.demo.DemoClass".toClass<DemoClass>()
|
||||
```
|
||||
|
||||
你还可以设置在获取到这个 `Class` 时是否自动执行其默认的静态方法块,默认情况下不会执行。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 获取并执行 DemoClass 默认的静态方法块
|
||||
"com.example.demo.DemoClass".toClass(initialize = true)
|
||||
```
|
||||
|
||||
默认的静态方法块在 Java 中使用如下方式定义。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```java:no-line-numbers
|
||||
public class DemoClass {
|
||||
|
||||
static {
|
||||
// 这里是静态方法块的内容
|
||||
}
|
||||
|
||||
public DemoClass() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## String.toClassOrNull <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClassOrNull(loader: ClassLoader?, initialize: Boolean): Class<*>?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> String.toClassOrNull(loader: ClassLoader?, initialize: Boolean): Class<T>?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过字符串类名转换为 `loader` 中的实体类。
|
||||
|
||||
找不到 `Class` 会返回 `null`,不会抛出异常。
|
||||
|
||||
**功能示例**
|
||||
|
||||
用法请参考 [String.toClass](#string-toclass-ext-method) 方法。
|
||||
|
||||
## classOf <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> classOf(loader: ClassLoader?, initialize: Boolean): Class<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过 `T` 得到其 `Class` 实例并转换为实体类。
|
||||
|
||||
**功能示例**
|
||||
|
||||
我们要获取一个 `Class` 在 `Kotlin` 下不通过反射时应该这样做。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
DemoClass::class.java
|
||||
```
|
||||
|
||||
现在,你可以直接 `cast` 一个实例并获取它的 `Class` 对象,必须在当前 `ClassLoader` 下存在。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
classOf<DemoClass>()
|
||||
```
|
||||
|
||||
若目标存在的 `Class` 为 `stub`,通过这种方式,你还可以自定义 `Class` 所在的 `ClassLoader`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
classOf<DemoClass>(customClassLoader)
|
||||
```
|
||||
|
||||
## String.hasClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.hasClass(loader: ClassLoader?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过字符串类名使用指定的 `ClassLoader` 查找是否存在。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以轻松的使用此方法判断字符串中的类是否存在,效果等同于直接使用 `Class.forName`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
if("com.example.demo.DemoClass".hasClass()) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
填入方法中的 `loader` 参数可判断指定的 `ClassLoader` 中的 `Class` 是否存在。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
if("com.example.demo.DemoClass".hasClass(customClassLoader)) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class.hasField <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasField(initiate: FieldConditions): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找变量是否存在。
|
||||
|
||||
## Class.hasMethod <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasMethod(initiate: MethodConditions): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找方法是否存在。
|
||||
|
||||
## Class.hasConstructor <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasConstructor(initiate: ConstructorConditions): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找构造方法是否存在。
|
||||
|
||||
## Member.hasModifiers <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Member.hasModifiers(conditions: ModifierConditions): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找 `Member` 中匹配的描述符。
|
||||
|
||||
## Class.hasModifiers <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasModifiers(conditions: ModifierConditions): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找 `Class` 中匹配的描述符。
|
||||
|
||||
## Class.field <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.field(initiate: FieldConditions): FieldFinder.Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找并得到变量。
|
||||
|
||||
## Class.method <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.method(initiate: MethodConditions): MethodFinder.Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找并得到方法。
|
||||
|
||||
## Class.constructor <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.constructor(initiate: ConstructorConditions): ConstructorFinder.Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 查找并得到构造方法。
|
||||
|
||||
## Class.generic <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Class<*>.generic(): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `Class` 的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## Class.generic <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `Class` 的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## Any.current <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean): CurrentClass
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean, initiate: CurrentClass.() -> Unit): T
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前实例的类操作对象。
|
||||
|
||||
## Class.buildOf <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions): Any?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <T> Class<*>.buildOf(vararg args: Any?, initiate: ConstructorConditions): T?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 通过构造方法创建新实例,指定类型 `T` 或任意类型 `Any`。
|
||||
|
||||
## Class.allMethods <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allMethods(isAccessible: Boolean, result: (index: Int, method: Method) -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 遍历当前类中的所有方法。
|
||||
|
||||
## Class.allConstructors <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allConstructors(isAccessible: Boolean, result: (index: Int, constructor: Constructor<*>) -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 遍历当前类中的所有构造方法。
|
||||
|
||||
## Class.allFields <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allFields(isAccessible: Boolean, result: (index: Int, field: Field) -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 遍历当前类中的所有变量。
|
@@ -0,0 +1,119 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# BaseFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
abstract class BaseFinder
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是 `Class` 与 `Member` 查找类功能的基本类实现。
|
||||
|
||||
## BaseFinder.IndexTypeCondition <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class IndexTypeCondition internal constructor(private val type: IndexConfigType)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 字节码下标筛选实现类。
|
||||
|
||||
### index <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun index(num: Int)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置下标。
|
||||
|
||||
若 `index` 小于零则为倒序,此时可以使用 `IndexTypeConditionSort.reverse` 方法实现。
|
||||
|
||||
可使用 `IndexTypeConditionSort.first` 和 `IndexTypeConditionSort.last` 设置首位和末位筛选条件。
|
||||
|
||||
### index <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun index(): IndexTypeConditionSort
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到下标。
|
||||
|
||||
### IndexTypeConditionSort <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class IndexTypeConditionSort internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 字节码下标排序实现类。
|
||||
|
||||
#### first <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun first()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置满足条件的第一个。
|
||||
|
||||
#### last <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun last()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置满足条件的最后一个。
|
||||
|
||||
#### reverse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun reverse(num: Int)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置倒序下标。
|
@@ -0,0 +1,75 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# CountRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class CountRules private constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个模糊 `Class`、`Member` 数组 (下标) 个数条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## Int.isZero <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.isZero(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否为 0。
|
||||
|
||||
## Int.moreThan <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.moreThan(count: Int): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 大于 `count`。
|
||||
|
||||
## Int.lessThan <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.lessThan(count: Int): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 小于 `count`。
|
||||
|
||||
## Int.inInterval <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.inInterval(countRange: IntRange): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 在 `countRange` 区间 A ≤ this ≤ B。
|
@@ -0,0 +1,205 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ModifierRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ModifierRules private constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个 `Class`、`Member` 描述符条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## isPublic <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isPublic: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `public`。
|
||||
|
||||
## isPrivate <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isPrivate: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `private`。
|
||||
|
||||
## isProtected <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isProtected: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `protected`。
|
||||
|
||||
## isStatic <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isStatic: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `static`。
|
||||
|
||||
对于任意的静态 `Class`、`Member` 可添加此描述进行确定。
|
||||
|
||||
::: warning
|
||||
|
||||
Kotlin → Jvm 后的 **object** 类中的方法并不是静态的。
|
||||
|
||||
:::
|
||||
|
||||
## isFinal <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isFinal: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `final`。
|
||||
|
||||
::: warning
|
||||
|
||||
Kotlin → Jvm 后没有 **open** 符号标识的 **Class**、**Member** 和没有任何关联的 **Class**、**Member** 都将为 **final**。
|
||||
|
||||
:::
|
||||
|
||||
## isSynchronized <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isSynchronized: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `synchronized`。
|
||||
|
||||
## isVolatile <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isVolatile: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 类型是否包含 `volatile`。
|
||||
|
||||
## isTransient <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isTransient: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 类型是否包含 `transient`。
|
||||
|
||||
## isNative <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isNative: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 类型是否包含 `native`。
|
||||
|
||||
对于任意 JNI 对接的 `Method` 可添加此描述进行确定。
|
||||
|
||||
## isInterface <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isInterface: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class` 类型是否包含 `interface`。
|
||||
|
||||
## isAbstract <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isAbstract: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `abstract`。
|
||||
|
||||
对于任意的抽象 `Class`、`Member` 可添加此描述进行确定。
|
||||
|
||||
## isStrict <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isStrict: Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `strictfp`。
|
@@ -0,0 +1,121 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# NameRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class NameRules private constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个模糊 `Class`、`Member` 名称条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## String.isSynthetic <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isSynthetic(index: Int): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否为匿名类的主类调用对象。
|
||||
|
||||
## String.isOnlySymbols <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlySymbols(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有符号。
|
||||
|
||||
## String.isOnlyLetters <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLetters(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有字母。
|
||||
|
||||
## String.isOnlyNumbers <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyNumbers(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有数字。
|
||||
|
||||
## String.isOnlyLettersNumbers <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLettersNumbers(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有字母或数字。
|
||||
|
||||
## String.isOnlyLowercase <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLowercase(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有小写字母。
|
||||
|
||||
在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
|
||||
|
||||
## String.isOnlyUppercase <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyUppercase(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 是否只有大写字母。
|
||||
|
||||
在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
|
@@ -0,0 +1,19 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ObjectRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ObjectRules private constructor(private val instance: Any)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个任意对象条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
@@ -0,0 +1,726 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# DexClassFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class DexClassFinder internal constructor(
|
||||
private val context: Context?,
|
||||
internal var name: String,
|
||||
internal var async: Boolean,
|
||||
override val loaderSet: ClassLoader?
|
||||
) : ClassBaseFinder
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class` 查找类。
|
||||
|
||||
可使用 `BaseDexClassLoader` 通过指定条件查找指定 `Class` 或一组 `Class`。
|
||||
|
||||
::: warning
|
||||
|
||||
此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
|
||||
|
||||
:::
|
||||
|
||||
## companion object <span class="symbol">- object</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
### clearCache <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun clearCache(context: Context, versionName: String?, versionCode: Long?)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 清除当前 `DexClassFinder` 的 `Class` 缓存。
|
||||
|
||||
适用于全部通过 [ClassLoader.searchClass](../../../factory/ReflectionFactory#classloader-searchclass-ext-method) 获取的 `DexClassFinder`。
|
||||
|
||||
## fullName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var fullName: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 完整名称。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
例如 `com.demo.Test` 需要填写 `com.demo.Test`。
|
||||
|
||||
## simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var simpleName: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 简单名称。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 会为空,此时你可以使用 [singleName](#singlename-field)。
|
||||
|
||||
## singleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var singleName: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 独立名称。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。
|
||||
|
||||
## from <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun from(vararg name: String): FromPackageRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置在指定包名范围查找当前 `Class`。
|
||||
|
||||
设置后仅会在当前 `name` 开头匹配的包名路径下进行查找,可提升查找速度。
|
||||
|
||||
例如 ↓
|
||||
|
||||
`com.demo.test`
|
||||
|
||||
`com.demo.test.demo`
|
||||
|
||||
::: warning
|
||||
|
||||
建议设置此参数指定查找范围,否则 **Class** 过多时将会非常慢。
|
||||
|
||||
:::
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## fullName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun fullName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 完整名称。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
例如 `com.demo.Test` 需要填写 `com.demo.Test`。
|
||||
|
||||
## simpleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun simpleName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 简单名称。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest 会为空`,此时你可以使用 [singleName](#singlename-method)。
|
||||
|
||||
## singleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun singleName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 独立名称。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。
|
||||
|
||||
## fullName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun fullName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 完整名称条件。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
## simpleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun simpleName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 简单名称条件。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
## singleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun singleName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 独立名称条件。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
## extends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> extends()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 继承的父类。
|
||||
|
||||
## extends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun extends(vararg name: String)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 继承的父类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的父类。
|
||||
|
||||
## implements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> implements()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 实现的接口类。
|
||||
|
||||
## implements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun implements(vararg name: String)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 实现的接口类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的接口类。
|
||||
|
||||
## anonymous <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun anonymous()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 标识 `Class` 为匿名类。
|
||||
|
||||
例如 `com.demo.Test$1` 或 `com.demo.Test$InnerTest`。
|
||||
|
||||
标识后你可以使用 [enclosing](#enclosing-method) 来进一步指定匿名类的 (封闭类) 主类。
|
||||
|
||||
## noExtends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noExtends()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 没有任何继承。
|
||||
|
||||
此时 `Class` 只应该继承于 `Any`。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [extends](#extends-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## noImplements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noImplements()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 没有任何接口。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [implements](#implements-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## noSuper <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noSuper()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 没有任何继承与接口。
|
||||
|
||||
此时 `Class` 只应该继承于 `Any`。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [extends](#extends-method) 与 [implements](#implements-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## enclosing <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> enclosing()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 匿名类的 (封闭类) 主类。
|
||||
|
||||
## enclosing <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun enclosing(vararg name: String)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 匿名类的 (封闭类) 主类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的 (封闭类) 主类。
|
||||
|
||||
## FromPackageRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class FromPackageRules internal constructor(private val packages: ArrayList<ClassRulesData.PackageRulesData>)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 包名范围名称过滤匹配条件实现类。
|
||||
|
||||
### absolute <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun absolute()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置包名绝对匹配。
|
||||
|
||||
例如有如下包名 ↓
|
||||
|
||||
`com.demo.test.a`
|
||||
|
||||
`com.demo.test.a.b`
|
||||
|
||||
`com.demo.test.active`
|
||||
|
||||
若包名条件为 `com.demo.test.a` 则绝对匹配仅能匹配到第一个。
|
||||
|
||||
相反地,不设置以上示例会全部匹配。
|
||||
|
||||
## ClassNameRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ClassNameRules internal constructor(private val name: ClassRulesData.NameRulesData)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 类名匹配条件实现类。
|
||||
|
||||
### optional <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun optional()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置类名可选。
|
||||
|
||||
例如有如下类名 ↓
|
||||
|
||||
`com.demo.Test` **fullName** / `Test` **simpleName**
|
||||
|
||||
`defpackage.a` **fullName** / `a` **simpleName**
|
||||
|
||||
这两个类名都是同一个类,但是在有些版本中被混淆有些版本没有。
|
||||
|
||||
此时可设置类名为 `com.demo.Test` **fullName** / `Test` **simpleName**。
|
||||
|
||||
这样就可在完全匹配类名情况下使用类名而忽略其它查找条件,否则忽略此条件继续使用其它查找条件。
|
||||
|
||||
## member <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun member(initiate: MemberRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 满足的 `Member` 条件。
|
||||
|
||||
## field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 满足的 `Field` 条件。
|
||||
|
||||
## method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 满足的 `Method` 条件。
|
||||
|
||||
## constructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun constructor(initiate: ConstructorRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Class` 满足的 `Constructor` 条件。
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal var isNotFound: Boolean, internal var throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Class` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(): Class<*>?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身。
|
||||
|
||||
若有多个 `Class` 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
若你设置了 `async` 请使用 [wait](#wait-method) 方法。
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashSet<Class<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(result: (Class<*>) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组 (依次遍历)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将不会执行。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(result: (Class<*>?) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身 (异步)。
|
||||
|
||||
若有多个 `Class` 结果只会回调第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调 null。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [get](#get-method) 方法。
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
### onNoClassDefFoundError <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onNoClassDefFoundError(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 监听找不到 `Class` 时。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 [onNoClassDefFoundError](#onnoclassdeffounderror-method) 方法。
|
@@ -0,0 +1,145 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ConstructorRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ConstructorRules internal constructor(internal val rulesData: ConstructorRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Constructor` 查找条件实现类。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(conditions: ObjectsConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
@@ -0,0 +1,93 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# FieldRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class FieldRules internal constructor(internal val rulesData: FieldRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 查找条件实现类。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
## type <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var type: Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 名称条件。
|
||||
|
||||
## type <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun type(conditions: ObjectConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 类型条件。
|
||||
|
||||
可不填写类型。
|
@@ -0,0 +1,33 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# MemberRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MemberRules internal constructor(internal val rulesData: MemberRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Member` 查找条件实现类。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Member` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
@@ -0,0 +1,205 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# MethodRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MethodRules internal constructor(internal val rulesData: MethodRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 查找条件实现类。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 名称。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## returnType <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var returnType: Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 返回值。
|
||||
|
||||
可不填写返回值。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Method` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Method** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(conditions: ObjectsConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Method** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 名称条件。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
||||
|
||||
## returnType <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun returnType(conditions: ObjectConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 返回值条件。
|
||||
|
||||
可不填写返回值。
|
@@ -0,0 +1,73 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# MemberRulesResult <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MemberRulesResult internal constructor(private val rulesData: MemberRulesData)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 `Member` 查找条件结果实现类。
|
||||
|
||||
## none <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun none(): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中个数为 `0`。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(num: Int): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(numRange: IntRange): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数范围。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(conditions: CountConditions): MemberRulesResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数条件。
|
@@ -0,0 +1,615 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ConstructorFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ConstructorFinder internal constructor(override val classSet: Class<*>) : MemberBaseFinder
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Constructor` 查找类。
|
||||
|
||||
可通过指定类型查找指定 `Constructor` 或一组 `Constructor`。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件,默认模糊查找并取第一个匹配的 `Constructor`。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 [VagueType](../../../type/defined/DefinedTypeFactory#vaguetype-field) 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(conditions: ObjectsConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(num: Int): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Constructor` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(isOnlySuperClass: Boolean)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置在 `classSet` 的所有父类中查找当前 `Constructor`。
|
||||
|
||||
::: warning
|
||||
|
||||
若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。
|
||||
|
||||
:::
|
||||
|
||||
## RemedyPlan <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class RemedyPlan internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Constructor` 重查找实现类,可累计失败次数直到查找成功。
|
||||
|
||||
### constructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun constructor(initiate: ConstructorConditions)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建需要重新查找的 `Constructor`。
|
||||
|
||||
你可以添加多个备选 `Constructor`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `RemedyPlan` 结果实现类。
|
||||
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以方便地对重查找的 `Constructor` 实现 `onFind` 方法。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.onFind {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Constructor` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.result {
|
||||
get().call()
|
||||
all()
|
||||
remedys {}
|
||||
onNoSuchConstructor {}
|
||||
}
|
||||
```
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(): Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 请使用 **wait** 回调结果方法。
|
||||
|
||||
:::
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过获得方法所在实例来执行构造方法创建新的实例对象。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().call()
|
||||
```
|
||||
|
||||
你可以 `cast` 构造方法为指定类型的实例对象。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().newInstance<TestClass>()
|
||||
```
|
||||
|
||||
::: danger
|
||||
|
||||
若构造方法含有参数则后方参数必填。
|
||||
|
||||
:::
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().newInstance<TestClass>("param1", "param2")
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例结果。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Constructor`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.all().forEach { instance ->
|
||||
instance.call(...)
|
||||
}
|
||||
```
|
||||
|
||||
### give <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun give(): Constructor<*>?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Constructor` 本身。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Constructor<*>>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(initiate: Instance.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类,配合 `RemedyPlan` 使用。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(initiate: ArrayList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例结果。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建 `Constructor` 重查找功能。
|
||||
|
||||
**功能示例**
|
||||
|
||||
当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchConstructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 监听找不到 `Constructor` 时。
|
||||
|
||||
只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
::: warning
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 **onNoSuchConstructor** 方法。
|
||||
|
||||
:::
|
||||
|
||||
### Instance <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Instance internal constructor(private val constructor: Constructor<*>?)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Constructor` 实例处理类。
|
||||
|
||||
#### call <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun call(vararg args: Any?): Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Constructor` 创建目标实例,不指定目标实例类型。
|
||||
|
||||
#### newInstance <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> newInstance(vararg args: Any?): T?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Constructor` 创建目标实例 ,指定 `T` 目标实例类型。
|
@@ -0,0 +1,819 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# FieldFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class FieldFinder internal constructor(override val classSet: Class<*>?) : MemberBaseFinder
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 查找类。
|
||||
|
||||
可通过指定类型查找指定 `Field` 或一组 `Field`。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
:::
|
||||
|
||||
## type <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var type: Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## order <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun order(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 顺序筛选字节码的下标。
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(value: String): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 名称条件。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## type <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun type(value: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## type <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun type(conditions: ObjectConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Field` 类型条件。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(isOnlySuperClass: Boolean)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置在 `classSet` 的所有父类中查找当前 `Field`。
|
||||
|
||||
::: warning
|
||||
|
||||
若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。
|
||||
|
||||
:::
|
||||
|
||||
## RemedyPlan <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class RemedyPlan internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 重查找实现类,可累计失败次数直到查找成功。
|
||||
|
||||
### field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建需要重新查找的 `Field`。
|
||||
|
||||
你可以添加多个备选 `Field`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `RemedyPlan` 结果实现类。
|
||||
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Field>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以方便地对重查找的 `Field` 实现 `onFind` 方法。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.onFind {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.result {
|
||||
get(instance).set("something")
|
||||
get(instance).string()
|
||||
get(instance).cast<CustomClass>()
|
||||
get().boolean()
|
||||
all(instance)
|
||||
give()
|
||||
giveAll()
|
||||
onNoSuchField {}
|
||||
}
|
||||
```
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(instance: Any?): Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类。
|
||||
|
||||
若有多个 `Field` 结果只会返回第一个。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以轻松地得到 `Field` 的实例以及使用它进行设置实例。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.get(instance).set("something")
|
||||
```
|
||||
|
||||
如果你取到的是静态 `Field`,可以不需要设置实例。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.get().set("something")
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例结果。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.all(instance).forEach { instance ->
|
||||
instance.self
|
||||
}
|
||||
```
|
||||
|
||||
### give <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun give(): Field?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Field` 本身。
|
||||
|
||||
若有多个 Field 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Field>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类,配合 `RemedyPlan` 使用。
|
||||
|
||||
若有多个 `Field` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例结果。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建 `Field` 重查找功能。
|
||||
|
||||
**功能示例**
|
||||
|
||||
当你遇到一种 `Field` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchField` 捕获异常二次查找 `Field`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
field {
|
||||
// Your code here.
|
||||
}
|
||||
field {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchField <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onNoSuchField(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 监听找不到 `Field` 时。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
::: warning
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 **onNoSuchField** 方法。
|
||||
|
||||
:::
|
||||
|
||||
### Instance <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Instance internal constructor(private val instance: Any?, private val field: Field?)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Field` 实例变量处理类。
|
||||
|
||||
#### current <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun current(ignored: Boolean): CurrentClass?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun current(ignored: Boolean, initiate: CurrentClass.() -> Unit): Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得当前 `Field` 自身 `self` 实例的类操作对象 `CurrentClass`。
|
||||
|
||||
#### cast <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> cast(): T?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` 实例。
|
||||
|
||||
#### byte <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun byte(): Byte?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Byte 实例。
|
||||
|
||||
#### int <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun int(): Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Int 实例。
|
||||
|
||||
#### long <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun long(): Long
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Long 实例。
|
||||
|
||||
#### short <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun short(): Short
|
||||
```
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Short 实例。
|
||||
|
||||
#### double <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun double(): Double
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Double 实例。
|
||||
|
||||
#### float <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun float(): Float
|
||||
```
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Float 实例。
|
||||
|
||||
#### string <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun string(): String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` String 实例。
|
||||
|
||||
#### char <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun char(): Char
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Char 实例。
|
||||
|
||||
#### boolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun boolean(): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Boolean 实例。
|
||||
|
||||
#### any <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun any(): Any?
|
||||
```
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Any 实例。
|
||||
|
||||
#### array <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> array(): Array<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` Array 实例。
|
||||
|
||||
#### list <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> list(): List<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到当前 `Field` List 实例。
|
||||
|
||||
#### set <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun set(any: Any?)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Field` 实例。
|
||||
|
||||
#### setTrue <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setTrue()
|
||||
```
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Field` 实例为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保实例对象类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
#### setFalse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setFalse()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Field` 实例为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保实例对象类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
#### setNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setNull()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置当前 `Field` 实例为 `null`。
|
@@ -0,0 +1,891 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# MethodFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MethodFinder internal constructor(override val classSet: Class<*>) : MemberBaseFinder
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 查找类。
|
||||
|
||||
可通过指定类型查找指定 `Method` 或一组 `Method`。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## returnType <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var returnType: Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 返回值,可不填写返回值。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Method` 中存在一些无意义又很长的类型,你可以使用 [VagueType](../../../type/defined/DefinedTypeFactory#vaguetype-field) 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Method** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(conditions: ObjectsConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Method** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## order <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun order(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 顺序筛选字节码的下标。
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(value: String): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 名称条件。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(num: Int): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## returnType <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun returnType(value: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 返回值。
|
||||
|
||||
可不填写返回值。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## returnType <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun returnType(conditions: ObjectConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置 `Method` 返回值条件。
|
||||
|
||||
可不填写返回值。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(isOnlySuperClass: Boolean)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 设置在 `classSet` 的所有父类中查找当前 `Method`。
|
||||
|
||||
::: warning
|
||||
|
||||
若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。
|
||||
|
||||
:::
|
||||
|
||||
## RemedyPlan <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class RemedyPlan internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 重查找实现类,可累计失败次数直到查找成功。
|
||||
|
||||
### method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodConditions): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建需要重新查找的 `Method`。
|
||||
|
||||
你可以添加多个备选 `Method`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `RemedyPlan` 结果实现类。
|
||||
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Method>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以方便地对重查找的 `Method` 实现 `onFind` 方法。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.onFind {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.result {
|
||||
get(instance).call()
|
||||
all(instance)
|
||||
remedys {}
|
||||
onNoSuchMethod {}
|
||||
}
|
||||
```
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(instance: Any?): Instance
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类。
|
||||
|
||||
若有多个 `Method` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 请使用 **wait** 回调结果方法。
|
||||
|
||||
:::
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过获得方法所在实例来执行 `Method`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.get(instance).call()
|
||||
```
|
||||
|
||||
若当前为静态方法,你可以不设置实例。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.get().call()
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例结果。
|
||||
|
||||
**功能示例**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Method`,其方法所在实例用法与 `get` 相同。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.all(instance).forEach { instance ->
|
||||
instance.call(...)
|
||||
}
|
||||
```
|
||||
|
||||
### give <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun give(): Method?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Method` 本身。
|
||||
|
||||
若有多个 `Method` 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Method>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到 `Method` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类,配合 `RemedyPlan` 使用。
|
||||
|
||||
若有多个 `Method` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
||||
返回全部查找条件匹配的多个 `Method` 实例结果。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 创建 `Method` 重查找功能。
|
||||
|
||||
**功能示例**
|
||||
|
||||
当你遇到一种 `Method` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchMethod` 捕获异常二次查找 `Method`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
method {
|
||||
// Your code here.
|
||||
}
|
||||
method {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchMethod <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onNoSuchMethod(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 监听找不到 `Method` 时。
|
||||
|
||||
只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
::: warning
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 **onNoSuchMethod** 方法。
|
||||
|
||||
:::
|
||||
|
||||
### Instance <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Instance internal constructor(private val instance: Any?, private val method: Method?)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> `Method` 实例处理类。
|
||||
|
||||
#### call <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun call(vararg args: Any?): Any?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,不指定返回值类型。
|
||||
|
||||
#### invoke <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> invoke(vararg args: Any?): T?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 `T` 返回值类型。
|
||||
|
||||
#### byte <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun byte(vararg args: Any?): Byte?
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Byte 返回值类型。
|
||||
|
||||
#### int <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun int(vararg args: Any?): Int
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Int 返回值类型。
|
||||
|
||||
#### long <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun long(vararg args: Any?): Long
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Long 返回值类型。
|
||||
|
||||
#### short <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun short(vararg args: Any?): Short
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Short 返回值类型。
|
||||
|
||||
#### double <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun double(vararg args: Any?): Double
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Double 返回值类型。
|
||||
|
||||
#### float <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun float(vararg args: Any?): Float
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Float 返回值类型。
|
||||
|
||||
#### string <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun string(vararg args: Any?): String
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 String 返回值类型。
|
||||
|
||||
#### char <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun char(vararg args: Any?): Char
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Char 返回值类型。
|
||||
|
||||
#### boolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun boolean(vararg args: Any?): Boolean
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Boolean 返回值类型。
|
||||
|
||||
### array <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> array(vararg args: Any?): Array<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 Array 返回值类型。
|
||||
|
||||
### list <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> list(vararg args: Any?): List<T>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 执行 `Method`,指定 List 返回值类型。
|
@@ -0,0 +1,15 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ComponentTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiReflection/blob/master/yukireflection/src/api/kotlin/com/highcapable/yukireflection/type/android/ComponentTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,15 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# GraphicsTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiReflection/blob/master/yukireflection/src/api/kotlin/com/highcapable/yukireflection/type/android/GraphicsTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,15 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# ViewTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiReflection/blob/master/yukireflection/src/api/kotlin/com/highcapable/yukireflection/type/android/ViewTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,27 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# DefinedTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个内部类型的定义常量类,主要用于反射 API 相关用法的延伸。
|
||||
|
||||
## VagueType <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val VagueType: Class<*>
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 得到模糊类型。
|
@@ -0,0 +1,15 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
# VariableTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.0` `添加`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 这是一个预置反射类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiReflection/blob/master/yukireflection/src/api/kotlin/com/highcapable/yukireflection/type/java/VariableTypeFactory.kt) 进行查看。
|
121
docs-source/src/zh-cn/config/api-example.md
Normal file
121
docs-source/src/zh-cn/config/api-example.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# API 基本配置
|
||||
|
||||
> 这里介绍了 `YukiReflection` 的基本配置方法。
|
||||
|
||||
`YukiReflection` 无需一些复杂的配置即可直接开始使用,且不会与 `Java` 原生的反射 API 冲突。
|
||||
|
||||
你可以在使用之前对 `YukiReflection` 进行一些功能配置。
|
||||
|
||||
## 获取 API 版本
|
||||
|
||||
你可以通过如下方式获取当前 `YukiReflection` 的 API 版本。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 获取版本名称
|
||||
val versionName = YukiReflection.API_VERSION_NAME
|
||||
// 获取版本号
|
||||
val versionCode = YukiReflection.API_VERSION_CODE
|
||||
```
|
||||
|
||||
你可以通过获取版本进行一些不同版本差异的判断或用于显示在关于信息中。
|
||||
|
||||
::: tip
|
||||
|
||||
更多功能请参考 [YukiReflection](../api/public/com/highcapable/yukireflection/YukiReflection)。
|
||||
|
||||
:::
|
||||
|
||||
## 配置 API 相关功能
|
||||
|
||||
你可以通过 `YukiReflection.configs { ... }` 方法或 `YukiReflection.Configs` 来配置相关功能。
|
||||
|
||||
### 自定义调试日志标签
|
||||
|
||||
你可以使用如下方式来自定义调试日志的标签。
|
||||
|
||||
API 内部的日志将会使用此标签进行打印。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 通过 configs 方法
|
||||
YukiReflection.configs {
|
||||
debugTag = "YourCustomTag"
|
||||
}
|
||||
// 直接设置
|
||||
YukiReflection.Configs.debugTag = "YourCustomTag"
|
||||
```
|
||||
|
||||
### 启用或禁用 Debug 模式
|
||||
|
||||
你可以使用如下方式来启用或禁用 Debug 模式。
|
||||
|
||||
Debug 模式默认是关闭的,启用后将会打印详细日志 (例如反射查找功能的耗时) 到控制台。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 通过 configs 方法
|
||||
YukiReflection.configs {
|
||||
isDebug = true
|
||||
}
|
||||
// 直接设置
|
||||
YukiReflection.Configs.isDebug = true
|
||||
```
|
||||
|
||||
### 启用或禁用调试日志的输出功能
|
||||
|
||||
你可以使用如下方式来启用或禁用调试日志的输出功能。
|
||||
|
||||
此功能默认启用,关闭后将会停用 `YukiReflection` 对全部日志的输出。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 通过 configs 方法
|
||||
YukiReflection.configs {
|
||||
isAllowPrintingLogs = true
|
||||
}
|
||||
// 直接设置
|
||||
YukiReflection.Configs.isAllowPrintingLogs = true
|
||||
```
|
||||
|
||||
### 启用或禁用 Member 缓存
|
||||
|
||||
你可以使用如下方式来启用或禁用 `Member` 缓存。
|
||||
|
||||
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 通过 configs 方法
|
||||
YukiReflection.configs {
|
||||
isEnableMemberCache = true
|
||||
}
|
||||
// 直接设置
|
||||
YukiReflection.Configs.isEnableMemberCache = true
|
||||
```
|
||||
|
||||
### 使用 configs 方法配置
|
||||
|
||||
为了一次性配置多个功能,你可以直接使用 `YukiReflection.configs { ... }` 方法进行配置。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
YukiReflection.configs {
|
||||
debugTag = "YourCustomTag"
|
||||
isDebug = true
|
||||
isAllowPrintingLogs = true
|
||||
isEnableMemberCache = true
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
|
||||
更多功能请参考 [YukiReflection.configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-method) 方法、[YukiReflection.Configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-object)。
|
||||
|
||||
:::
|
442
docs-source/src/zh-cn/config/api-exception.md
Normal file
442
docs-source/src/zh-cn/config/api-exception.md
Normal file
@@ -0,0 +1,442 @@
|
||||
---
|
||||
pageClass: hidden-anchor-page
|
||||
---
|
||||
|
||||
# API 异常处理
|
||||
|
||||
> 异常是在开发过程经常遇到的主要问题,这里介绍了 `YukiReflection` 在使用过程中可能遇到的常见异常以及处理方式。
|
||||
|
||||
这里的异常说明只会同步最新的 API 版本,较旧的 API 版本的异常将不会再进行说明,请始终保持 API 版本为最新。
|
||||
|
||||
## 非阻断异常
|
||||
|
||||
> 这些异常不会导致 APP 停止运行 (FC),但是会在控制台打印 `E` 级别的日志,也可能会停止继续执行相关功能。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Method/Constructor/Field match type "**TYPE**" not allowed
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法、构造方法以及变量时设置了不允许的参数类型。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 查找一个方法
|
||||
method {
|
||||
// ❗设置了无效的类型举例
|
||||
param(false, 1, 0)
|
||||
// ❗设置了无效的类型举例
|
||||
returnType = false
|
||||
}
|
||||
|
||||
// 查找一个变量
|
||||
field {
|
||||
// ❗设置了无效的类型举例
|
||||
type = false
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
在查找中 `param`、`returnType`、`type` 中仅接受 `Class`、`String`、`VariousClass` 类型的传值,不可传入参数实例。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 查找一个方法
|
||||
method {
|
||||
// ✅ 正确的使用方法举例
|
||||
param(BooleanType, IntType, IntType)
|
||||
// ✅ 正确的使用方法举例
|
||||
returnType = BooleanType
|
||||
// ✅ 以下方案也是正确的
|
||||
returnType = "java.lang.Boolean"
|
||||
}
|
||||
|
||||
// 查找一个变量
|
||||
field {
|
||||
// ✅ 正确的使用方法举例
|
||||
type = BooleanType
|
||||
}
|
||||
```
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
NoSuchMethod/NoSuchConstructor/NoSuchField happend in \[**NAME**\]
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法、构造方法以及变量时并未找到目标方法、构造方法以及变量。
|
||||
|
||||
**解决方案**
|
||||
|
||||
请确认你的查找条件是否能正确匹配到目标 `Class` 中的指定方法、构造方法以及变量。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Trying **COUNT** times and all failure by RemedyPlan
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
使用 `RemedyPlan` 重新查找方法、构造方法、变量时依然没有找到方法、构造方法、变量。
|
||||
|
||||
**解决方案**
|
||||
|
||||
请确认你设置的 `RemedyPlan` 参数以及当前 APP 内存在的 `Class`,再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
You must set a condition when finding a Method/Constructor/Field
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法、构造方法以及变量时并未设置任何条件。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
// 这里没有设置任何条件
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
请将查找条件补充完整并再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Can't find this Class in \[**CLASSLOADER**\]: **CONTENT** Generated by YukiReflection#ReflectionTool
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
通过 `ClassLoader.searchClass` 找不到需要查找的 `Class` 对象。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
customClassLoader?.searchClass {
|
||||
from(...)
|
||||
// ...
|
||||
}.get()
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
这是一个安全异常,请检查你设置的条件,使用相关工具查看所在 **Dex** 中的 `Class` 以及字节码对象特征,并再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Can't find this Method/Constructor/Field in \[**CLASS**\]: **CONTENT** Generated by YukiReflection#ReflectionTool
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
通过指定条件找不到需要查找的方法、构造方法以及变量。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
TargetClass.method {
|
||||
name = "test"
|
||||
param(BooleanType)
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
这是一个安全异常,请检查你设置的条件,使用相关工具查看所在 `Class` 中的字节码对象特征,并再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
The number of VagueType must be at least less than the count of paramTypes
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在 `Method`、`Constructor` 查找条件中错误地使用了 `VagueType`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
TargetClass.method {
|
||||
name = "test"
|
||||
// <情景1>
|
||||
param(VagueType)
|
||||
// <情景2>
|
||||
param(VagueType, VagueType ...)
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
`VagueType` 不能在方法、构造方法参数中完全填充,若存在这样的需求请使用 `paramCount`。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Field match type class is not found
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找变量时所设置的查找条件中 `type` 的 `Class` 实例未被找到。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
name = "test"
|
||||
// 假设这里设置的 type 的 Class 并不存在
|
||||
type = "com.example.TestClass"
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
请检查查找条件中 `type` 的 `Class` 是否存在,然后再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Method match returnType class is not found
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法时所设置的查找条件中 `returnType` 的 `Class` 实例未被找到。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
name = "test"
|
||||
// 假设这里设置的 returnType 的 Class 并不存在
|
||||
returnType = "com.example.TestClass"
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
请检查查找条件中 `returnType` 的 `Class` 是否存在,然后再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger loggerE
|
||||
|
||||
Method/Constructor match paramType\[**INDEX**\] class is not found
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法、构造方法时所设置的查找条件中 `param` 的 `index` 号下标的 `Class` 实例未被找到。
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
name = "test"
|
||||
// 假设这里设置的 1 号下标的 Class 并不存在
|
||||
param(StringClass, "com.example.TestClass", BooleanType)
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
请检查查找条件中 `param` 的 `index` 号下标的 `Class` 是否存在,然后再试一次。
|
||||
|
||||
## 阻断异常
|
||||
|
||||
> 这些异常会直接导致 APP 停止运行 (FC),同时会在控制台打印 `E` 级别的日志。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger NoClassDefFoundError
|
||||
|
||||
Can't find this Class in \[**CLASSLOADER**\]: **CONTENT** Generated by YukiReflection#ReflectionTool
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
通过 `String.toClass(...)` 或 `classOf<...>()` 找不到需要查找的 `Class` 对象。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
"com.demo.Test".toClass()
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
请检查当前字符串或实体匹配到的 `Class` 是否存在于当前 `ClassLoader`,并再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
ClassLoader \[**CLASSLOADER**\] is not a DexClassLoader
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
使用 `ClassLoader.searchClass` 查找 `Class` 但是当前 `ClassLoader` 并不继承于 `BaseDexClassLoader`。
|
||||
|
||||
**解决方案**
|
||||
|
||||
这种情况基本不存在,除非当前 APP 引用了非 ART 平台的可执行文件 (但是这种情况还是不会存在) 或当前 `ClassLoader` 为空。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
VariousClass match failed of those **CLASSES**
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在使用 `VariousClass` 创建不确定的 `Class` 对象时全部的 `Class` 都没有被找到。
|
||||
|
||||
**解决方案**
|
||||
|
||||
检查当前 APP 内是否存在其中能够匹配的 `Class` 后,再试一次。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
paramTypes is empty, please use emptyParam() instead
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在查找方法、构造方法时保留了空的 `param` 方法。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
name = "test"
|
||||
// 括号内没有填写任何参数
|
||||
param()
|
||||
}
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
若要标识此方法、构造方法没有参数,你可以有如下设置方法。
|
||||
|
||||
第一种,设置 `emptyParam` (推荐)
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
name = "test"
|
||||
emptyParam()
|
||||
}
|
||||
```
|
||||
|
||||
第二种,设置 `paramCount = 0`
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
method {
|
||||
name = "test"
|
||||
paramCount = 0
|
||||
}
|
||||
```
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
Cannot create classes cache for "android", please remove "name" param
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
在系统框架 (android) 中使用了 `DexClassFinder` 的缓存功能 `searchClass(name = ...)`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
searchClass(name = "test") {
|
||||
from(...)
|
||||
// ...
|
||||
}.get()
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
由于缓存会将找到的 `Class` 名称存入 `SharedPreferences`,但是系统框架不存在 data 目录,所以请不要在系统框架中使用此功能。
|
||||
|
||||
###### exception
|
||||
|
||||
::: danger IllegalStateException
|
||||
|
||||
Target Class type cannot cast to **TYPE**
|
||||
|
||||
:::
|
||||
|
||||
**异常原因**
|
||||
|
||||
使用 `Class.toClass`、`Class.toClassOrNull`、`GenericClass.argument` 方法将字符串类名转换为目标 `Class` 时声明了错误的类型。
|
||||
|
||||
以下使用 `Class.toClass` 方法来进行示例。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// 假设目标类型是 Activity 但是被错误地转换为了 WrongClass 类型
|
||||
val clazz = "android.app.Activity".toClass<WrongClass>()
|
||||
```
|
||||
|
||||
**解决方案**
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
// <解决方案 1> 填写正确的类型
|
||||
val clazz1 = "android.app.Activity".toClass<Activity>()
|
||||
// <解决方案 2> 不填写泛型声明
|
||||
val clazz2 = "android.app.Activity".toClass()
|
||||
```
|
||||
|
||||
请确保执行方法后声明的泛型是指定的目标 `Class` 类型,在不确定目标类型的情况下你可以不需要填写泛型声明。
|
56
docs-source/src/zh-cn/guide/home.md
Normal file
56
docs-source/src/zh-cn/guide/home.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# 介绍
|
||||
|
||||
> `YukiReflection` 是一个基于 Android 平台的反射 API。
|
||||
|
||||
## 背景
|
||||
|
||||
这是一个使用 `Kotlin` 基于 `Java` 原生反射 API 重新打造的一套简洁、高效的反射 API。
|
||||
|
||||
`YukiReflection` 同时也是 [YukiHookAPI](https://github.com/fankes/YukiHookAPI) 正在使用的核心功能。
|
||||
|
||||
名称取自 [《ももくり》女主 栗原 雪(Yuki)](https://www.bilibili.com/bangumi/play/ss5016)。
|
||||
|
||||
## 用途
|
||||
|
||||
`YukiReflection` 完全采用 `Kotlin` `lambda` 语法构建。
|
||||
|
||||
它能取代 [Java 原生的反射 API](https://pdai.tech/md/java/basic/java-basic-x-reflection.html),使用更加人性化的语言实现一套更加完善的反射方案。
|
||||
|
||||
## 语言要求
|
||||
|
||||
请使用 `Kotlin`,API 部分代码构成同样兼容 `Java` 但基础反射场景的实现**可能完全无法使用**。
|
||||
|
||||
文档全部的 Demo 示例代码都将使用 `Kotlin` 进行描述,如果你完全不会使用 `Kotlin` 那你将有可能无法使用 `YukiReflection`。
|
||||
|
||||
## 灵感来源
|
||||
|
||||
`YukiReflection` 最初是集成在 [YukiHookAPI](https://github.com/fankes/YukiHookAPI) 项目中的核心功能,现在进行了解耦合,使得这套反射 API 可以在任何 Android 平台的项目中使用。
|
||||
|
||||
现在,我们只需要编写少量的代码,就能实现一个简单的反射调用。
|
||||
|
||||
借助 `Kotlin` 优雅的 `lambda` 写法以及 `YukiReflection`,可以让你的反射逻辑更加美观清晰。
|
||||
|
||||
> 示例如下
|
||||
|
||||
:::: code-group
|
||||
::: code-group-item Yuki Reflection
|
||||
|
||||
```kotlin
|
||||
"android.os.SystemProperties".toClass()
|
||||
.method {
|
||||
name = "get"
|
||||
param(StringClass, StringClass)
|
||||
}.get().call("ro.system.build.fingerprint", "none")
|
||||
```
|
||||
|
||||
:::
|
||||
::: code-group-item Java Reflection
|
||||
|
||||
```kotlin
|
||||
Class.forName("android.os.SystemProperties")
|
||||
.getDeclaredMethod("get", String::class.java, String::class.java)
|
||||
.invoke(null, "ro.system.build.fingerprint", "none")
|
||||
```
|
||||
|
||||
:::
|
||||
::::
|
73
docs-source/src/zh-cn/guide/quick-start.md
Normal file
73
docs-source/src/zh-cn/guide/quick-start.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 快速开始
|
||||
|
||||
> 集成 `YukiReflection` 到你的项目中。
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Windows 7 及以上/macOS 10.14 及以上/Linux 发行版(Arch/Debian)
|
||||
|
||||
- Android Studio 2021.1 及以上
|
||||
|
||||
- IntelliJ IDEA 2021.1 及以上
|
||||
|
||||
- Kotlin 1.7.0 及以上
|
||||
|
||||
- Android Gradle Plugin 7.0 及以上
|
||||
|
||||
- Gradle 7.0 及以上
|
||||
|
||||
- Jvm 11 及以上
|
||||
|
||||
## 项目要求
|
||||
|
||||
项目需要使用 `Android Studio` 或 `IntelliJ IDEA` 创建且类型为 Android 项目并已集成 `Kotlin` 环境依赖。
|
||||
|
||||
## 集成依赖
|
||||
|
||||
**(可选)** 在你的项目 `build.gradle` 中添加依赖。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
// MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
|
||||
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
|
||||
}
|
||||
```
|
||||
|
||||
在你的 app `build.gradle` 中添加依赖。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
// 基础依赖
|
||||
implementation 'com.highcapable.yukireflection:api:<yuki-version>'
|
||||
}
|
||||
```
|
||||
|
||||
请将 **<yuki-version>** 修改为 [这里](../about/changelog) 的最新版本。
|
||||
|
||||
::: danger
|
||||
|
||||
如果你的项目目前正在使用 [YukiHookAPI](https://github.com/fankes/YukiHookAPI),请不要重复集成 **YukiReflection**,因为 **YukiHookAPI** 已经包含了其中的功能且存在针对相关功能的改动,重复集成会造成功能性冲突引发异常,此时你应该前往 **YukiHookAPI** 的 [文档](https://fankes.github.io/YukiHookAPI/zh-cn/) 查看对应使用教程。
|
||||
|
||||
:::
|
||||
|
||||
在你的 app `build.gradle` 中修改 `Kotlin` 的 Jvm 版本为 11 及以上。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```groovy
|
||||
android {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '11'
|
||||
}
|
||||
}
|
||||
```
|
13
docs-source/src/zh-cn/index.md
Normal file
13
docs-source/src/zh-cn/index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
home: true
|
||||
title: 首页
|
||||
heroImage: /images/logo.png
|
||||
actions:
|
||||
- text: 快速上手
|
||||
link: /zh-cn/guide/home
|
||||
type: primary
|
||||
- text: 更新日志
|
||||
link: /zh-cn/about/changelog
|
||||
type: secondary
|
||||
footer: MIT License | Copyright (C) 2019-2023 HighCapable
|
||||
---
|
Reference in New Issue
Block a user