├── .editorconfig
├── .github
└── workflows
│ └── docs-deploy.yml
├── .gitignore
├── .idea
├── .gitignore
├── AndroidProjectSystem.xml
├── icon.png
├── inspectionProfiles
│ └── Project_Default.xml
├── kotlinc.xml
├── ktlint-plugin.xml
├── ktlint.xml
├── migrations.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README-zh-CN.md
├── README.md
├── build.gradle.kts
├── docs-source
├── .gitignore
├── .vscode
│ └── settings.json
├── package.json
├── src
│ ├── .vuepress
│ │ ├── config.ts
│ │ ├── configs
│ │ │ ├── template.ts
│ │ │ └── utils.ts
│ │ ├── public
│ │ │ └── images
│ │ │ │ └── logo.png
│ │ └── styles
│ │ │ └── index.scss
│ ├── en
│ │ ├── about
│ │ │ ├── about.md
│ │ │ ├── changelog.md
│ │ │ ├── contacts.md
│ │ │ └── future.md
│ │ ├── api
│ │ │ ├── features.md
│ │ │ ├── home.md
│ │ │ └── public
│ │ │ │ └── com
│ │ │ │ └── highcapable
│ │ │ │ └── yukireflection
│ │ │ │ ├── YukiReflection.md
│ │ │ │ ├── bean
│ │ │ │ ├── CurrentClass.md
│ │ │ │ ├── GenericClass.md
│ │ │ │ └── VariousClass.md
│ │ │ │ ├── factory
│ │ │ │ └── ReflectionFactory.md
│ │ │ │ ├── finder
│ │ │ │ ├── base
│ │ │ │ │ ├── BaseFinder.md
│ │ │ │ │ └── rules
│ │ │ │ │ │ ├── CountRules.md
│ │ │ │ │ │ ├── ModifierRules.md
│ │ │ │ │ │ ├── NameRules.md
│ │ │ │ │ │ └── ObjectRules.md
│ │ │ │ ├── classes
│ │ │ │ │ ├── DexClassFinder.md
│ │ │ │ │ └── rules
│ │ │ │ │ │ ├── ConstructorRules.md
│ │ │ │ │ │ ├── FieldRules.md
│ │ │ │ │ │ ├── MemberRules.md
│ │ │ │ │ │ ├── MethodRules.md
│ │ │ │ │ │ └── result
│ │ │ │ │ │ └── MemberRulesResult.md
│ │ │ │ └── members
│ │ │ │ │ ├── ConstructorFinder.md
│ │ │ │ │ ├── FieldFinder.md
│ │ │ │ │ └── MethodFinder.md
│ │ │ │ ├── log
│ │ │ │ └── YLog.md
│ │ │ │ └── type
│ │ │ │ ├── android
│ │ │ │ ├── ComponentTypeFactory.md
│ │ │ │ ├── GraphicsTypeFactory.md
│ │ │ │ └── ViewTypeFactory.md
│ │ │ │ ├── defined
│ │ │ │ └── DefinedTypeFactory.md
│ │ │ │ └── java
│ │ │ │ └── VariableTypeFactory.md
│ │ ├── config
│ │ │ ├── api-example.md
│ │ │ └── api-exception.md
│ │ ├── guide
│ │ │ ├── home.md
│ │ │ └── quick-start.md
│ │ └── index.md
│ ├── index.md
│ └── zh-cn
│ │ ├── about
│ │ ├── about.md
│ │ ├── changelog.md
│ │ ├── contacts.md
│ │ └── future.md
│ │ ├── api
│ │ ├── features.md
│ │ ├── home.md
│ │ └── public
│ │ │ └── com
│ │ │ └── highcapable
│ │ │ └── yukireflection
│ │ │ ├── YukiReflection.md
│ │ │ ├── bean
│ │ │ ├── CurrentClass.md
│ │ │ ├── GenericClass.md
│ │ │ └── VariousClass.md
│ │ │ ├── factory
│ │ │ └── ReflectionFactory.md
│ │ │ ├── finder
│ │ │ ├── base
│ │ │ │ ├── BaseFinder.md
│ │ │ │ └── rules
│ │ │ │ │ ├── CountRules.md
│ │ │ │ │ ├── ModifierRules.md
│ │ │ │ │ ├── NameRules.md
│ │ │ │ │ └── ObjectRules.md
│ │ │ ├── classes
│ │ │ │ ├── DexClassFinder.md
│ │ │ │ └── rules
│ │ │ │ │ ├── ConstructorRules.md
│ │ │ │ │ ├── FieldRules.md
│ │ │ │ │ ├── MemberRules.md
│ │ │ │ │ ├── MethodRules.md
│ │ │ │ │ └── result
│ │ │ │ │ └── MemberRulesResult.md
│ │ │ └── members
│ │ │ │ ├── ConstructorFinder.md
│ │ │ │ ├── FieldFinder.md
│ │ │ │ └── MethodFinder.md
│ │ │ ├── log
│ │ │ └── YLog.md
│ │ │ └── type
│ │ │ ├── android
│ │ │ ├── ComponentTypeFactory.md
│ │ │ ├── GraphicsTypeFactory.md
│ │ │ └── ViewTypeFactory.md
│ │ │ ├── defined
│ │ │ └── DefinedTypeFactory.md
│ │ │ └── java
│ │ │ └── VariableTypeFactory.md
│ │ ├── config
│ │ ├── api-example.md
│ │ └── api-exception.md
│ │ ├── guide
│ │ ├── home.md
│ │ └── quick-start.md
│ │ └── index.md
└── yarn.lock
├── gradle.properties
├── gradle
├── sweet-dependency
│ └── sweet-dependency-config.yaml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── img-src
└── icon.png
├── samples
├── demo-android
│ ├── build.gradle.kts
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── highcapable
│ │ │ └── yukireflection
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── ic_launcher-playstore.png
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── highcapable
│ │ │ │ └── yukireflection
│ │ │ │ └── demo_app
│ │ │ │ ├── test
│ │ │ │ └── Main.java
│ │ │ │ └── ui
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_foreground.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_foreground.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_foreground.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_foreground.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_foreground.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── values-night
│ │ │ └── themes.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── ic_launcher_background.xml
│ │ │ ├── strings.xml
│ │ │ └── themes.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── highcapable
│ │ └── yukireflection
│ │ └── ExampleUnitTest.kt
└── demo-jvm
│ ├── build.gradle.kts
│ └── src
│ └── main
│ └── java
│ └── com
│ └── highcapable
│ └── yukireflection
│ └── demo_jvm
│ ├── Main.kt
│ └── test
│ └── Main.java
├── settings.gradle.kts
└── yukireflection-core
├── build.gradle.kts
├── libs
└── android-34.jar
└── src
└── main
└── java
└── com
└── highcapable
└── yukireflection
├── YukiReflection.kt
├── bean
├── CurrentClass.kt
├── GenericClass.kt
└── VariousClass.kt
├── factory
└── ReflectionFactory.kt
├── finder
├── base
│ ├── BaseFinder.kt
│ ├── ClassBaseFinder.kt
│ ├── MemberBaseFinder.kt
│ ├── data
│ │ └── BaseRulesData.kt
│ └── rules
│ │ ├── CountRules.kt
│ │ ├── ModifierRules.kt
│ │ ├── NameRules.kt
│ │ └── ObjectRules.kt
├── classes
│ ├── DexClassFinder.kt
│ ├── data
│ │ └── ClassRulesData.kt
│ └── rules
│ │ ├── ConstructorRules.kt
│ │ ├── FieldRules.kt
│ │ ├── MemberRules.kt
│ │ ├── MethodRules.kt
│ │ ├── base
│ │ └── BaseRules.kt
│ │ └── result
│ │ └── MemberRulesResult.kt
├── members
│ ├── ConstructorFinder.kt
│ ├── FieldFinder.kt
│ ├── MethodFinder.kt
│ └── data
│ │ ├── ConstructorRulesData.kt
│ │ ├── FieldRulesData.kt
│ │ ├── MemberRulesData.kt
│ │ └── MethodRulesData.kt
├── tools
│ └── ReflectionTool.kt
└── type
│ └── factory
│ └── TypeAliasFactory.kt
├── log
└── YLog.kt
├── type
├── android
│ ├── ComponentTypeFactory.kt
│ ├── GraphicsTypeFactory.kt
│ └── ViewTypeFactory.kt
├── defined
│ └── DefinedTypeFactory.kt
└── java
│ └── VariableTypeFactory.kt
└── utils
└── factory
├── ThreadFactory.kt
├── ThrowableFactory.kt
└── VariableFactory.kt
/.editorconfig:
--------------------------------------------------------------------------------
1 | # noinspection EditorConfigKeyCorrectness
2 | [{*.kt,*.kts}]
3 | ktlint_standard_annotation = disabled
4 | ktlint_standard_filename = disabled
5 | ktlint_standard_wrapping = disabled
6 | ktlint_standard_import-ordering = enabled
7 | ktlint_standard_max-line-length = disabled
8 | ktlint_standard_multiline-if-else = disabled
9 | ktlint_standard_argument-list-wrapping = disabled
10 | ktlint_standard_parameter-list-wrapping = disabled
11 | ktlint_standard_trailing-comma-on-declaration-site = disabled
12 | ktlint_function_signature_body_expression_wrapping = multiline
13 | ktlint_standard_string-template-indent = disabled
14 | ktlint_standard_function-signature = disabled
15 | ktlint_standard_trailing-comma-on-call-site = disabled
16 | ktlint_standard_multiline-expression-wrapping = disabled
17 | ktlint_standard_no-empty-first-line-in-class-body = disabled
18 | ktlint_standard_if-else-wrapping = disabled
19 | ktlint_standard_if-else-bracing = disabled
20 | ktlint_standard_statement-wrapping = disabled
21 | ktlint_standard_blank-line-before-declaration = disabled
22 | ktlint_standard_no-empty-file = disabled
23 | ktlint_standard_property-naming = disabled
24 | ktlint_standard_function-naming = disabled
25 | ktlint_standard_chain-method-continuation = disabled
26 | ktlint_standard_class-signature = disabled
27 | ktlint_standard_condition-wrapping = disabled
28 | ktlint_standard_class-signature = disabled
29 | ktlint_standard_no-trailing-spaces = disabled
30 | ktlint_standard_multiline-loop = disabled
31 | ij_continuation_indent_size = 2
32 | indent_size = 4
33 | indent_style = space
34 | insert_final_newline = false
35 | max_line_length = 150
--------------------------------------------------------------------------------
/.github/workflows/docs-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to GitHub pages
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | branches: [ master ]
7 | paths:
8 | - 'docs-source/**'
9 | - '.github/workflows/**'
10 |
11 | permissions:
12 | contents: write
13 |
14 | jobs:
15 | docs:
16 | if: ${{ success() }}
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/checkout@v4
20 | with:
21 | fetch-depth: 0
22 | - name: Setup Node.js
23 | uses: actions/setup-node@v4
24 | with:
25 | node-version: 18
26 | - name: Build VuePress site
27 | run: |
28 | cd docs-source
29 | yarn -i
30 | yarn docs:build-gh-pages
31 | - name: Deploy to GitHub Pages
32 | uses: crazy-max/ghaction-github-pages@v4
33 | with:
34 | target_branch: gh-pages
35 | build_dir: docs-source/dist
36 | env:
37 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Fully .gtignore for IntelliJ, Android Studio and Gradle based Java projects
2 | ## References:
3 | ## - https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
4 | ## - https://github.com/android/platform-samples/blob/main/.gitignore
5 |
6 | # User-specific stuff
7 | .idea/**/workspace.xml
8 | .idea/**/tasks.xml
9 | .idea/**/usage.statistics.xml
10 | .idea/**/dictionaries
11 | .idea/**/shelf
12 |
13 | # AWS User-specific
14 | .idea/**/aws.xml
15 |
16 | # Generated files
17 | .idea/**/contentModel.xml
18 |
19 | # Sensitive or high-churn files
20 | .idea/**/dataSources/
21 | .idea/**/dataSources.ids
22 | .idea/**/dataSources.local.xml
23 | .idea/**/sqlDataSources.xml
24 | .idea/**/dynamic.xml
25 | .idea/**/uiDesigner.xml
26 | .idea/**/dbnavigator.xml
27 |
28 | # Gradle
29 | .idea/**/gradle.xml
30 | .idea/**/libraries
31 |
32 | # Gradle and Maven with auto-import
33 | .idea/.name
34 | .idea/artifacts
35 | .idea/compiler.xml
36 | .idea/jarRepositories.xml
37 | .idea/modules.xml
38 | .idea/*.iml
39 | .idea/modules
40 | .idea/caches
41 | .idea/material_theme**
42 | .idea/other.xml
43 | *.iml
44 | *.ipr
45 |
46 | # Kotlin
47 | .kotlin
48 |
49 | # Misc
50 | .idea/misc.xml
51 |
52 | # CMake
53 | cmake-build-*/
54 |
55 | # Mongo Explorer plugin
56 | .idea/**/mongoSettings.xml
57 |
58 | # File-based project format
59 | *.iws
60 |
61 | # IntelliJ
62 | out/
63 |
64 | # mpeltonen/sbt-idea plugin
65 | .idea_modules/
66 |
67 | # JIRA plugin
68 | atlassian-ide-plugin.xml
69 |
70 | # Cursive Clojure plugin
71 | .idea/replstate.xml
72 |
73 | # SonarLint plugin
74 | .idea/sonarlint/
75 |
76 | # Crashlytics plugin (for Android Studio and IntelliJ)
77 | com_crashlytics_export_strings.xml
78 | crashlytics.properties
79 | crashlytics-build.properties
80 | fabric.properties
81 |
82 | # Editor-based Rest Client
83 | .idea/httpRequests
84 |
85 | # Android studio 3.1+ serialized cache file
86 | .idea/caches/build_file_checksums.ser
87 |
88 | # Android studio 3.1+ additional
89 | .idea/deployment*.xml
90 | .idea/assetWizardSettings.xml
91 | .idea/androidTestResultsUserPreferences.xml
92 |
93 | # Android projects
94 | **/local.properties
95 | /captures
96 | .externalNativeBuild
97 | .cxx
98 |
99 | # Gradle projects
100 | .gradle
101 | build/
102 |
103 | # Mkdocs temporary serving folder
104 | docs-gen
105 | site
106 | *.bak
107 | .idea/appInsightsSettings.xml
108 |
109 | # Mac OS
110 | .DS_Store
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /gradle.xml
4 | /misc.xml
5 | /workspace.xml
--------------------------------------------------------------------------------
/.idea/AndroidProjectSystem.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/.idea/icon.png
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/ktlint-plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MANUAL
5 | false
6 |
7 |
--------------------------------------------------------------------------------
/.idea/ktlint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README-zh-CN.md:
--------------------------------------------------------------------------------
1 | # Yuki Reflection
2 |
3 | [](https://github.com/HighCapable/YukiReflection/blob/master/LICENSE)
4 | [](https://github.com/HighCapable/YukiReflection/releases)
5 | [](https://t.me/YukiReflection)
6 | [](https://t.me/HighCapable_Dev)
7 | [](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
8 |
9 |
10 |
11 | 🌴️ 一个使用 Kotlin 构建的用于 Java 和 Android 平台高效反射 API。
12 |
13 | [English](README.md) | 简体中文
14 |
15 | |
| [HighCapable](https://github.com/HighCapable) |
16 | |-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
17 |
18 | 这个项目属于上述组织,**点击上方链接关注这个组织**,发现更多好项目。
19 |
20 | ## 这是什么
21 |
22 | 这是一个使用 Kotlin 基于 Java 原生反射 API 重新打造的一套简洁、高效的反射 API,同时也是 [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI)
23 | 正在使用的核心功能。
24 |
25 | 名称取自 [《ももくり》女主 栗原 雪(Yuki)](https://www.bilibili.com/bangumi/play/ss5016)。
26 |
27 | ## 开始使用
28 |
29 | [点击这里](https://highcapable.github.io/YukiReflection/zh-cn/) 前往文档页面查看更多详细教程和内容。
30 |
31 | ## 项目推广
32 |
33 |
34 |
35 |
嘿,还请君留步!👋
36 |
这里有 Android 开发工具、UI 设计、Gradle 插件、Xposed 模块和实用软件等相关项目。
37 |
如果下方的项目能为你提供帮助,不妨为我点个 star 吧!
38 |
所有项目免费、开源,遵循对应开源许可协议。
39 |
40 |
41 |
42 | ## Star History
43 |
44 | 
45 |
46 | ## 许可证
47 |
48 | - [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
49 |
50 | ```
51 | Apache License Version 2.0
52 |
53 | Copyright (C) 2019 HighCapable
54 |
55 | Licensed under the Apache License, Version 2.0 (the "License");
56 | you may not use this file except in compliance with the License.
57 | You may obtain a copy of the License at
58 |
59 | https://www.apache.org/licenses/LICENSE-2.0
60 |
61 | Unless required by applicable law or agreed to in writing, software
62 | distributed under the License is distributed on an "AS IS" BASIS,
63 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 | See the License for the specific language governing permissions and
65 | limitations under the License.
66 | ```
67 |
68 | 版权所有 © 2019 HighCapable
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Yuki Reflection
2 |
3 | [](https://github.com/HighCapable/YukiReflection/blob/master/LICENSE)
4 | [](https://github.com/HighCapable/YukiReflection/releases)
5 | [](https://t.me/YukiReflection)
6 | [](https://t.me/HighCapable_Dev)
7 | [](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
8 |
9 |
10 |
11 | 🌴️ An efficient Reflection API for Java and Android built in Kotlin.
12 |
13 | English | [简体中文](README-zh-CN.md)
14 |
15 | |
| [HighCapable](https://github.com/HighCapable) |
16 | |-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
17 |
18 | This project belongs to the above-mentioned organization, **click the link above to follow this organization** and discover more good projects.
19 |
20 | ## What's this
21 |
22 | This is a concise and efficient Reflection API rebuilt based on Java's native Reflection API using Kotlin,
23 | and it is also the core function being used by [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI).
24 |
25 | The name is taken from ["ももくり" heroine Yuki Kurihara](https://www.bilibili.com/bangumi/play/ss5016).
26 |
27 | ## Get Started
28 |
29 | [Click here](https://highcapable.github.io/YukiReflection/en/) go to the documentation page for more detailed tutorials and content.
30 |
31 | ## Promotion
32 |
33 |
34 |
35 |
Hey, please stay! 👋
36 |
Here are related projects such as Android development tools, UI design, Gradle plugins, Xposed Modules and practical software.
37 |
If the project below can help you, please give me a star!
38 |
All projects are free, open source, and follow the corresponding open source license agreement.
39 |
40 |
41 |
42 | ## Star History
43 |
44 | 
45 |
46 | ## License
47 |
48 | - [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
49 |
50 | ```
51 | Apache License Version 2.0
52 |
53 | Copyright (C) 2019 HighCapable
54 |
55 | Licensed under the Apache License, Version 2.0 (the "License");
56 | you may not use this file except in compliance with the License.
57 | You may obtain a copy of the License at
58 |
59 | https://www.apache.org/licenses/LICENSE-2.0
60 |
61 | Unless required by applicable law or agreed to in writing, software
62 | distributed under the License is distributed on an "AS IS" BASIS,
63 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 | See the License for the specific language governing permissions and
65 | limitations under the License.
66 | ```
67 |
68 | Copyright © 2019 HighCapable
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | autowire(libs.plugins.android.application) apply false
3 | autowire(libs.plugins.kotlin.jvm) apply false
4 | autowire(libs.plugins.kotlin.android) apply false
5 | autowire(libs.plugins.jetbrains.compose) apply false
6 | autowire(libs.plugins.compose.compiler) apply false
7 | }
--------------------------------------------------------------------------------
/docs-source/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /src/.vuepress/.cache
3 | /src/.vuepress/.temp
4 | /dist
--------------------------------------------------------------------------------
/docs-source/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "git.ignoreLimitWarning": true
3 | }
--------------------------------------------------------------------------------
/docs-source/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "yukireflection_docs",
3 | "license": "Apache-2.0",
4 | "devDependencies": {
5 | "@mr-hope/vuepress-plugin-copy-code": "^1.30.0",
6 | "@vuepress/plugin-prismjs": "2.0.0-rc.0",
7 | "@vuepress/plugin-search": "2.0.0-rc.0",
8 | "@vuepress/plugin-shiki": "2.0.0-rc.0",
9 | "vuepress": "2.0.0-rc.0"
10 | },
11 | "scripts": {
12 | "docs:dev": "vuepress dev src",
13 | "docs:build": "vuepress build src",
14 | "docs:build-gh-pages": "vuepress build src && touch dist/.nojekyll"
15 | }
16 | }
--------------------------------------------------------------------------------
/docs-source/src/.vuepress/config.ts:
--------------------------------------------------------------------------------
1 | import { defaultTheme } from 'vuepress';
2 | import { shikiPlugin } from '@vuepress/plugin-shiki';
3 | import { searchPlugin } from '@vuepress/plugin-search';
4 | import { navBarItems, sideBarItems, configs } from './configs/template';
5 |
6 | export default {
7 | dest: configs.dev.dest,
8 | port: configs.dev.port,
9 | base: configs.website.base,
10 | head: [['link', { rel: 'icon', href: configs.website.icon }]],
11 | title: configs.website.title,
12 | description: configs.website.locales['/en/'].description,
13 | locales: configs.website.locales,
14 | theme: defaultTheme({
15 | logo: configs.website.logo,
16 | repo: configs.github.repo,
17 | docsRepo: configs.github.repo,
18 | docsBranch: configs.github.branch,
19 | docsDir: configs.github.dir,
20 | editLinkPattern: ':repo/edit/:branch/:path',
21 | sidebar: sideBarItems,
22 | sidebarDepth: 2,
23 | locales: {
24 | '/en/': {
25 | navbar: navBarItems['/en/'],
26 | selectLanguageText: 'English (US)',
27 | selectLanguageName: 'English',
28 | editLinkText: 'Edit this page on GitHub',
29 | tip: 'Tips',
30 | warning: 'Notice',
31 | danger: 'Pay Attention',
32 | },
33 | '/zh-cn/': {
34 | navbar: navBarItems['/zh-cn/'],
35 | selectLanguageText: '简体中文 (CN)',
36 | selectLanguageName: '简体中文',
37 | editLinkText: '在 GitHub 上编辑此页',
38 | notFound: ['这里什么都没有', '我们怎么到这来了?', '这是一个 404 页面', '看起来我们进入了错误的链接'],
39 | backToHome: '回到首页',
40 | contributorsText: '贡献者',
41 | lastUpdatedText: '上次更新',
42 | tip: '小提示',
43 | warning: '注意',
44 | danger: '特别注意',
45 | openInNewWindow: '在新窗口中打开',
46 | toggleColorMode: '切换颜色模式'
47 | }
48 | },
49 | }),
50 | plugins: [
51 | shikiPlugin({ theme: 'github-dark-dimmed' }),
52 | searchPlugin({
53 | isSearchable: (page) => page.path !== '/',
54 | locales: {
55 | '/en/': { placeholder: 'Search' },
56 | '/zh-cn/': { placeholder: '搜索' }
57 | }
58 | })
59 | ]
60 | };
--------------------------------------------------------------------------------
/docs-source/src/.vuepress/configs/utils.ts:
--------------------------------------------------------------------------------
1 | export const i18n = {
2 | space: ' ',
3 | string: (content: string, locale: string) => {
4 | return '/' + locale + content;
5 | },
6 | array: (contents: string[], locale: string) => {
7 | const newContents: string[] = [];
8 | contents.forEach((content) => {
9 | newContents.push(i18n.string(content, locale));
10 | });
11 | return newContents;
12 | }
13 | };
--------------------------------------------------------------------------------
/docs-source/src/.vuepress/public/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/docs-source/src/.vuepress/public/images/logo.png
--------------------------------------------------------------------------------
/docs-source/src/.vuepress/styles/index.scss:
--------------------------------------------------------------------------------
1 | $primary-color: rgb(49, 164, 255);
2 | $accent-color: rgb(129, 189, 249);
3 | $content-width: 965px;
4 | $scroll-bar-width: 8px;
5 | $scroll-bar-height: 6.5px;
6 | $scroll-bar-border-radius: 50px;
7 | $scroll-bar-track-color-code: rgb(86, 96, 110);
8 | $scroll-bar-thumb-hover-color-code: rgb(121, 135, 155);
9 |
10 | :root {
11 | --c-brand: #{$primary-color};
12 | --c-brand-light: #{$accent-color};
13 | --content-width: #{$content-width};
14 | }
15 |
16 | code {
17 | padding: 3px 5px 3px 5px;
18 | border-radius: 5px;
19 | }
20 |
21 | .badge {
22 | margin-bottom: 5px;
23 | }
24 |
25 | .custom-container {
26 | border-radius: 5px;
27 | }
28 |
29 | .sidebar-item {
30 | white-space: nowrap;
31 | overflow: hidden;
32 | text-overflow: ellipsis;
33 | }
34 |
35 | .language-text {
36 | ::-webkit-scrollbar-track {
37 | background: #{$scroll-bar-track-color-code};
38 | border-radius: #{$scroll-bar-border-radius};
39 | }
40 |
41 | ::-webkit-scrollbar-thumb:hover {
42 | background: #{$scroll-bar-thumb-hover-color-code};
43 | }
44 | }
45 |
46 | .language-kotlin {
47 | ::-webkit-scrollbar-track {
48 | background: #{$scroll-bar-track-color-code};
49 | border-radius: #{$scroll-bar-border-radius};
50 | }
51 |
52 | ::-webkit-scrollbar-thumb:hover {
53 | background: #{$scroll-bar-thumb-hover-color-code};
54 | }
55 | }
56 |
57 | .language-java {
58 | ::-webkit-scrollbar-track {
59 | background: #{$scroll-bar-track-color-code};
60 | border-radius: #{$scroll-bar-border-radius};
61 | }
62 |
63 | ::-webkit-scrollbar-thumb:hover {
64 | background: #{$scroll-bar-thumb-hover-color-code};
65 | }
66 | }
67 |
68 | .language-groovy {
69 | ::-webkit-scrollbar-track {
70 | background: #{$scroll-bar-track-color-code};
71 | border-radius: #{$scroll-bar-border-radius};
72 | }
73 |
74 | ::-webkit-scrollbar-thumb:hover {
75 | background: #{$scroll-bar-thumb-hover-color-code};
76 | }
77 | }
78 |
79 | .language-xml {
80 | ::-webkit-scrollbar-track {
81 | background: #{$scroll-bar-track-color-code};
82 | border-radius: #{$scroll-bar-border-radius};
83 | }
84 |
85 | ::-webkit-scrollbar-thumb:hover {
86 | background: #{$scroll-bar-thumb-hover-color-code};
87 | }
88 | }
89 |
90 | .hidden-anchor-page {
91 | h6 {
92 | color: transparent;
93 | margin-bottom: -35px;
94 | padding-top: 50px;
95 | }
96 | }
97 |
98 | .code-page {
99 | h1 {
100 | font-size: 24pt;
101 | }
102 |
103 | h2 {
104 | font-size: 18pt;
105 | }
106 |
107 | h3 {
108 | font-size: 15pt;
109 | }
110 |
111 | h4 {
112 | font-size: 12pt;
113 | }
114 |
115 | h5 {
116 | font-size: 9.6pt;
117 | }
118 |
119 | h6 {
120 | font-size: 8.4pt;
121 | }
122 |
123 | .symbol {
124 | color: rgb(142, 155, 168);
125 | }
126 |
127 | .deprecated {
128 | color: rgb(142, 155, 168);
129 | text-decoration: line-through;
130 | }
131 | }
132 |
133 | html {
134 | scroll-behavior: smooth;
135 |
136 | ::-webkit-scrollbar {
137 | width: #{$scroll-bar-width};
138 | height: #{$scroll-bar-height};
139 | }
140 |
141 | ::-webkit-scrollbar-track {
142 | background: rgb(234, 236, 239);
143 | }
144 |
145 | ::-webkit-scrollbar-thumb {
146 | background: rgb(189, 189, 189);
147 | border-radius: #{$scroll-bar-border-radius};
148 | }
149 |
150 | ::-webkit-scrollbar-thumb:hover {
151 | background: rgb(133, 133, 133);
152 | border-radius: #{$scroll-bar-border-radius};
153 | }
154 | }
155 |
156 | html.dark {
157 | --c-brand: #{$primary-color};
158 | --c-brand-light: #{$accent-color};
159 | --content-width: #{$content-width};
160 |
161 | ::-webkit-scrollbar {
162 | width: #{$scroll-bar-width};
163 | height: #{$scroll-bar-height};
164 | }
165 |
166 | ::-webkit-scrollbar-track {
167 | background: rgb(41, 46, 53);
168 | }
169 |
170 | ::-webkit-scrollbar-thumb {
171 | background: rgb(65, 72, 83);
172 | border-radius: #{$scroll-bar-border-radius};
173 | }
174 |
175 | ::-webkit-scrollbar-thumb:hover {
176 | background: rgb(56, 62, 72);
177 | border-radius: #{$scroll-bar-border-radius};
178 | }
179 | }
--------------------------------------------------------------------------------
/docs-source/src/en/about/about.md:
--------------------------------------------------------------------------------
1 | # About This Document
2 |
3 | > This document is powered by [VuePress](https://v2.vuepress.vuejs.org/en).
4 |
5 | ## License
6 |
7 | [Apache-2.0](https://github.com/HighCapable/YukiReflection/blob/master/LICENSE)
8 |
9 | ```:no-line-numbers
10 | Apache License Version 2.0
11 |
12 | Copyright (C) 2019 HighCapable
13 |
14 | Licensed under the Apache License, Version 2.0 (the "License");
15 | you may not use this file except in compliance with the License.
16 | You may obtain a copy of the License at
17 |
18 | https://www.apache.org/licenses/LICENSE-2.0
19 |
20 | Unless required by applicable law or agreed to in writing, software
21 | distributed under the License is distributed on an "AS IS" BASIS,
22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | See the License for the specific language governing permissions and
24 | limitations under the License.
25 | ```
26 |
27 | Copyright © 2019 HighCapable
--------------------------------------------------------------------------------
/docs-source/src/en/about/changelog.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | > The version update history of `YukiReflection` is recorded here.
4 |
5 | ::: danger
6 |
7 | We will only maintain the latest API version, if you are using an outdate API version, you voluntarily renounce any possibility of maintenance.
8 |
9 | :::
10 |
11 | ::: warning
12 |
13 | To avoid translation time consumption, Changelog will use **Google Translation** from **Chinese** to **English**, please refer to the original text for actual reference.
14 |
15 | Time zone of version release date: **UTC+8**
16 |
17 | :::
18 |
19 | ### 1.0.3 | 2023.10.07
20 |
21 | - The license agreement has been changed from `MIT` to `Apache-2.0`, subsequent versions will be distributed under this license agreement, you should change the relevant license agreement after using this version
22 | - Change the type of dependency library from **Android Library** (aar) back to **Java Library** (jar)
23 | - Adapt and support the native Java platform (some functions are only available on the Android platform)
24 | - Fixed [fix get interfaces of class](https://github.com/HighCapable/YukiHookAPI/pull/38) issue and merged into `YukiReflection`
25 | - Deprecated ~~`isAllowPrintingLogs`~~, please start using the `debugLog` method
26 | - Added `YukiReflection.TAG`
27 | - Obsolete ~~`YukiReflection.API_VERSION_NAME`~~, ~~`YukiReflection.API_VERSION_CODE`~~, merged into `YukiReflection.VERSION`
28 | - Refactored `remendy` functionality in find methods, which now prints exceptions in steps
29 | - The multi-method find result type is changed from `HashSet` to `MutableList`
30 | - Added `method()`, `constructor()`, `field()` to directly obtain all object functions in the class
31 | - `constructor()` no longer behaves like `constructor { emptyParam() }`
32 | - Added `lazyClass` and `lazyClassOrNull` methods to lazily load `Class`
33 |
34 | ### 1.0.2 | 2023.04.25
35 |
36 | - Fixed a critical issue where the `Member` cache did not take effect and persistent storage eventually caused app out of memory (OOM), thanks to [Art-Chen](https://github.com/Art-Chen)
37 | - Remove the direct cache function of `Member` and deprecated ~~`YukiReflection.Configs.isEnableMemberCache`~~, keep the cache function of `Class`
38 | - Modified finder to `Sequence`, optimize the finding speed and performance of `Member`
39 |
40 | ### 1.0.1 | 2023.04.16
41 |
42 | - Change the type of dependency library from **Java Library** (jar) to **Android Library** (aar)
43 | - Removed wrong `Class` object declaration in Android `type`
44 |
45 | ### 1.0.0 | 2023.01.26
46 |
47 | - The first version is submitted to Maven
--------------------------------------------------------------------------------
/docs-source/src/en/about/contacts.md:
--------------------------------------------------------------------------------
1 | # Contact Us
2 |
3 | > If you have any questions in use, or have any constructive suggestions, you can contact us.
4 |
5 | Join our developers group.
6 |
7 | - [Click to join Telegram group](https://t.me/YukiReflection)
8 | - [Click to join Telegram group (Developer)](https://t.me/HighCapable_Dev)
9 |
10 | Find me on **Twitter** [@fankesyooni](https://twitter.com/fankesyooni).
11 |
12 | ## Help with Maintenance
13 |
14 | Thank you for choosing and using `YukiReflection`.
15 |
16 | If you have code-related suggestions and requests, you can submit a Pull Request on GitHub.
--------------------------------------------------------------------------------
/docs-source/src/en/api/home.md:
--------------------------------------------------------------------------------
1 | ---
2 | next:
3 | text: Public API
4 | link: /en/api/public/com/highcapable/yukireflection/YukiReflection
5 | ---
6 |
7 | # Document Introduce
8 |
9 | > The document here will synchronize the relevant usage of the latest API version, please keep `YukiReflection` as the latest version to use the latest version of the function.
10 |
11 | ## Function Description
12 |
13 | > The function description mainly introduces the related usage and purpose of the current API.
14 |
15 | ## Function Example Description
16 |
17 | > The function examples mainly show the basic usage examples of the current API for reference.
18 |
19 | ## Change Record Description
20 |
21 | The function of the first version will be marked as `v` `first`;
22 |
23 | New function added later will be marked as `v` `added`;
24 |
25 | Later modified function will be appended as `v` `modified`;
26 |
27 | Later deprecated function will be marked as `v` `deprecated` and strikethrough;
28 |
29 | Later removed function will be marked as `v` `removed` and strikethrough.
30 |
31 | ## Related Symbols Description
32 |
33 | - *kt* Kotlin Static File
34 |
35 | - *annotation* Annotation Class
36 |
37 | - *interface* Interface Class
38 |
39 | - *object* Class (Singleton)
40 |
41 | - *class* Class
42 |
43 | - *field* Field or `get` / `set` method or read-only `get` method
44 |
45 | - *method* Method
46 |
47 | - *enum* Enum constant
48 |
49 | - *ext-field* Extension field (global)
50 |
51 | - *ext-method* Extension method (global)
52 |
53 | - *i-ext-field* Extension field (internal)
54 |
55 | - *i-ext-method* Extension method (internal)
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/YukiReflection.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # YukiReflection - object
14 |
15 | ```kotlin:no-line-numbers
16 | object YukiReflection
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是 `YukiReflection` 的装载调用类。
26 |
27 | ## TAG - field
28 |
29 | ```kotlin:no-line-numbers
30 | const val TAG: String
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.3` `added`
36 |
37 | **Function Illustrate**
38 |
39 | > 获取当前 `YukiReflection` 的名称 (标签)。
40 |
41 | ## VERSION - field
42 |
43 | ```kotlin:no-line-numbers
44 | const val VERSION: String
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.3` `added`
50 |
51 | **Function Illustrate**
52 |
53 | > 获取当前 `YukiReflection` 的版本。
54 |
55 | API_VERSION_NAME - field
56 |
57 | **Change Records**
58 |
59 | `v1.0.0` `first`
60 |
61 | `v1.0.3` `deprecated`
62 |
63 | 不再区分版本名称和版本号,请迁移到 `VERSION`
64 |
65 | API_VERSION_CODE - field
66 |
67 | **Change Records**
68 |
69 | `v1.0.0` `first`
70 |
71 | `v1.0.3` `deprecated`
72 |
73 | 不再区分版本名称和版本号,请迁移到 `VERSION`
74 |
75 | ## Configs - object
76 |
77 | ```kotlin:no-line-numbers
78 | object Configs
79 | ```
80 |
81 | **Change Records**
82 |
83 | `v1.0.0` `first`
84 |
85 | **Function Illustrate**
86 |
87 | > 对 API 相关功能的配置类。
88 |
89 | ### debugLog - method
90 |
91 | ```kotlin:no-line-numbers
92 | inline fun debugLog(initiate: YLog.Configs.() -> Unit)
93 | ```
94 |
95 | **Change Records**
96 |
97 | `v1.0.3` `added`
98 |
99 | **Function Illustrate**
100 |
101 | > 配置 `YLog.Configs` 相关参数。
102 |
103 | debugTag - field
104 |
105 | **Change Records**
106 |
107 | `v1.0.0` `first`
108 |
109 | `v1.0.3` `deprecated`
110 |
111 | 请迁移到 `debugLog`
112 |
113 | ### isDebug - field
114 |
115 | ```kotlin:no-line-numbers
116 | var isDebug: Boolean
117 | ```
118 |
119 | **Change Records**
120 |
121 | `v1.0.0` `first`
122 |
123 | **Function Illustrate**
124 |
125 | > 是否启用 Debug 模式。
126 |
127 | 默认不启用,启用后将交由日志输出管理器打印详细日志 (例如反射查找功能的耗时) 到控制台。
128 |
129 | isAllowPrintingLogs - field
130 |
131 | **Change Records**
132 |
133 | `v1.0.0` `first`
134 |
135 | `v1.0.3` `deprecated`
136 |
137 | 请迁移到 `debugLog`
138 |
139 | isEnableMemberCache - field
140 |
141 | **Change Records**
142 |
143 | `v1.0.0` `first`
144 |
145 | `v1.0.2` `deprecated`
146 |
147 | `Member` 的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
148 |
149 | ## configs - method
150 |
151 | ```kotlin:no-line-numbers
152 | inline fun configs(initiate: Configs.() -> Unit)
153 | ```
154 |
155 | **Change Records**
156 |
157 | `v1.0.0` `first`
158 |
159 | **Function Illustrate**
160 |
161 | > 对 `Configs` 类实现了一个 **lambda** 方法体。
162 |
163 | 你可以轻松地调用它进行配置。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/bean/GenericClass.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # GenericClass - class
14 |
15 | ```kotlin:no-line-numbers
16 | class GenericClass internal constructor(private val type: ParameterizedType)
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 当前 `Class` 的泛型父类操作对象。
26 |
27 | ## argument - method
28 |
29 | ```kotlin:no-line-numbers
30 | fun argument(index: Int): Class<*>?
31 | ```
32 |
33 | ```kotlin:no-line-numbers
34 | inline fun argument(index: Int): Class?
35 | ```
36 |
37 | **Change Records**
38 |
39 | `v1.0.0` `first`
40 |
41 | `v1.0.3` `modified`
42 |
43 | 方法的返回值可为 `null`
44 |
45 | **Function Illustrate**
46 |
47 | > 获得泛型参数数组下标的 `Class` 实例。
48 |
49 | ::: warning
50 |
51 | 在运行时局部变量的泛型会被擦除,获取不到时将会返回 **null**。
52 |
53 | :::
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/bean/VariousClass.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # VariousClass - class
14 |
15 | ```kotlin:no-line-numbers
16 | class VariousClass(private vararg val name: String)
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是一个不确定性 `Class` 类名装载器,通过 `name` 装载 `Class` 名称数组。
26 |
27 | ## get - method
28 |
29 | ```kotlin:no-line-numbers
30 | fun get(loader: ClassLoader? = null, initialize: Boolean): Class<*>
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 获取匹配的实体类。
40 |
41 | 使用当前 `loader` 装载目标 `Class`。
42 |
43 | ## getOrNull - method
44 |
45 | ```kotlin:no-line-numbers
46 | fun getOrNull(loader: ClassLoader? = null, initialize: Boolean): Class<*>?
47 | ```
48 |
49 | **Change Records**
50 |
51 | `v1.0.0` `first`
52 |
53 | **Function Illustrate**
54 |
55 | > 获取匹配的实体类。
56 |
57 | 使用当前 `loader` 装载目标 `Class`。
58 |
59 | 匹配不到 `Class` 会返回 `null`,不会抛出异常。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/base/BaseFinder.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # BaseFinder - class
14 |
15 | ```kotlin:no-line-numbers
16 | abstract class BaseFinder
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是 `Class` 与 `Member` 查找类功能的基本类实现。
26 |
27 | ## BaseFinder.IndexTypeCondition - class
28 |
29 | ```kotlin:no-line-numbers
30 | inner class IndexTypeCondition internal constructor(private val type: IndexConfigType)
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 字节码下标筛选实现类。
40 |
41 | ### index - method
42 |
43 | ```kotlin:no-line-numbers
44 | fun index(num: Int)
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.0` `first`
50 |
51 | **Function Illustrate**
52 |
53 | > 设置下标。
54 |
55 | 若 `index` 小于零则为倒序,此时可以使用 `IndexTypeConditionSort.reverse` 方法实现。
56 |
57 | 可使用 `IndexTypeConditionSort.first` 和 `IndexTypeConditionSort.last` 设置首位和末位筛选条件。
58 |
59 | ### index - method
60 |
61 | ```kotlin:no-line-numbers
62 | fun index(): IndexTypeConditionSort
63 | ```
64 |
65 | **Change Records**
66 |
67 | `v1.0.0` `first`
68 |
69 | **Function Illustrate**
70 |
71 | > 得到下标。
72 |
73 | ### IndexTypeConditionSort - class
74 |
75 | ```kotlin:no-line-numbers
76 | inner class IndexTypeConditionSort internal constructor()
77 | ```
78 |
79 | **Change Records**
80 |
81 | `v1.0.0` `first`
82 |
83 | **Function Illustrate**
84 |
85 | > 字节码下标排序实现类。
86 |
87 | #### first - method
88 |
89 | ```kotlin:no-line-numbers
90 | fun first()
91 | ```
92 |
93 | **Change Records**
94 |
95 | `v1.0.0` `first`
96 |
97 | **Function Illustrate**
98 |
99 | > 设置满足条件的第一个。
100 |
101 | #### last - method
102 |
103 | ```kotlin:no-line-numbers
104 | fun last()
105 | ```
106 |
107 | **Change Records**
108 |
109 | `v1.0.0` `first`
110 |
111 | **Function Illustrate**
112 |
113 | > 设置满足条件的最后一个。
114 |
115 | #### reverse - method
116 |
117 | ```kotlin:no-line-numbers
118 | fun reverse(num: Int)
119 | ```
120 |
121 | **Change Records**
122 |
123 | `v1.0.0` `first`
124 |
125 | **Function Illustrate**
126 |
127 | > 设置倒序下标。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/base/rules/CountRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # CountRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class CountRules private constructor()
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是一个模糊 `Class`、`Member` 数组 (下标) 个数条件实现类。
26 |
27 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
28 |
29 | ## Int.isZero - i-ext-method
30 |
31 | ```kotlin:no-line-numbers
32 | fun Int.isZero(): Boolean
33 | ```
34 |
35 | **Change Records**
36 |
37 | `v1.0.0` `first`
38 |
39 | **Function Illustrate**
40 |
41 | > 是否为 0。
42 |
43 | ## Int.moreThan - i-ext-method
44 |
45 | ```kotlin:no-line-numbers
46 | fun Int.moreThan(count: Int): Boolean
47 | ```
48 |
49 | **Change Records**
50 |
51 | `v1.0.0` `first`
52 |
53 | **Function Illustrate**
54 |
55 | > 大于 `count`。
56 |
57 | ## Int.lessThan - i-ext-method
58 |
59 | ```kotlin:no-line-numbers
60 | fun Int.lessThan(count: Int): Boolean
61 | ```
62 |
63 | **Change Records**
64 |
65 | `v1.0.0` `first`
66 |
67 | **Function Illustrate**
68 |
69 | > 小于 `count`。
70 |
71 | ## Int.inInterval - i-ext-method
72 |
73 | ```kotlin:no-line-numbers
74 | fun Int.inInterval(countRange: IntRange): Boolean
75 | ```
76 |
77 | **Change Records**
78 |
79 | `v1.0.0` `first`
80 |
81 | **Function Illustrate**
82 |
83 | > 在 `countRange` 区间 A ≤ this ≤ B。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/base/rules/ModifierRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # ModifierRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class ModifierRules private constructor()
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是一个 `Class`、`Member` 描述符条件实现类。
26 |
27 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
28 |
29 | ## isPublic - i-ext-field
30 |
31 | ```kotlin:no-line-numbers
32 | val isPublic: Boolean
33 | ```
34 |
35 | **Change Records**
36 |
37 | `v1.0.0` `first`
38 |
39 | **Function Illustrate**
40 |
41 | > `Class`、`Member` 类型是否包含 `public`。
42 |
43 | ## isPrivate - i-ext-field
44 |
45 | ```kotlin:no-line-numbers
46 | val isPrivate: Boolean
47 | ```
48 |
49 | **Change Records**
50 |
51 | `v1.0.0` `first`
52 |
53 | **Function Illustrate**
54 |
55 | > `Class`、`Member` 类型是否包含 `private`。
56 |
57 | ## isProtected - i-ext-field
58 |
59 | ```kotlin:no-line-numbers
60 | val isProtected: Boolean
61 | ```
62 |
63 | **Change Records**
64 |
65 | `v1.0.0` `first`
66 |
67 | **Function Illustrate**
68 |
69 | > `Class`、`Member` 类型是否包含 `protected`。
70 |
71 | ## isStatic - i-ext-field
72 |
73 | ```kotlin:no-line-numbers
74 | val isStatic: Boolean
75 | ```
76 |
77 | **Change Records**
78 |
79 | `v1.0.0` `first`
80 |
81 | **Function Illustrate**
82 |
83 | > `Class`、`Member` 类型是否包含 `static`。
84 |
85 | 对于任意的静态 `Class`、`Member` 可添加此描述进行确定。
86 |
87 | ::: warning
88 |
89 | Kotlin → Jvm 后的 **object** 类中的方法并不是静态的。
90 |
91 | :::
92 |
93 | ## isFinal - i-ext-field
94 |
95 | ```kotlin:no-line-numbers
96 | val isFinal: Boolean
97 | ```
98 |
99 | **Change Records**
100 |
101 | `v1.0.0` `first`
102 |
103 | **Function Illustrate**
104 |
105 | > `Class`、`Member` 类型是否包含 `final`。
106 |
107 | ::: warning
108 |
109 | Kotlin → Jvm 后没有 **open** 符号标识的 **Class**、**Member** 和没有任何关联的 **Class**、**Member** 都将为 **final**。
110 |
111 | :::
112 |
113 | ## isSynchronized - i-ext-field
114 |
115 | ```kotlin:no-line-numbers
116 | val isSynchronized: Boolean
117 | ```
118 |
119 | **Change Records**
120 |
121 | `v1.0.0` `first`
122 |
123 | **Function Illustrate**
124 |
125 | > `Class`、`Member` 类型是否包含 `synchronized`。
126 |
127 | ## isVolatile - i-ext-field
128 |
129 | ```kotlin:no-line-numbers
130 | val isVolatile: Boolean
131 | ```
132 |
133 | **Change Records**
134 |
135 | `v1.0.0` `first`
136 |
137 | **Function Illustrate**
138 |
139 | > `Field` 类型是否包含 `volatile`。
140 |
141 | ## isTransient - i-ext-field
142 |
143 | ```kotlin:no-line-numbers
144 | val isTransient: Boolean
145 | ```
146 |
147 | **Change Records**
148 |
149 | `v1.0.0` `first`
150 |
151 | **Function Illustrate**
152 |
153 | > `Field` 类型是否包含 `transient`。
154 |
155 | ## isNative - i-ext-field
156 |
157 | ```kotlin:no-line-numbers
158 | val isNative: Boolean
159 | ```
160 |
161 | **Change Records**
162 |
163 | `v1.0.0` `first`
164 |
165 | **Function Illustrate**
166 |
167 | > `Method` 类型是否包含 `native`。
168 |
169 | 对于任意 JNI 对接的 `Method` 可添加此描述进行确定。
170 |
171 | ## isInterface - i-ext-field
172 |
173 | ```kotlin:no-line-numbers
174 | val isInterface: Boolean
175 | ```
176 |
177 | **Change Records**
178 |
179 | `v1.0.0` `first`
180 |
181 | **Function Illustrate**
182 |
183 | > `Class` 类型是否包含 `interface`。
184 |
185 | ## isAbstract - i-ext-field
186 |
187 | ```kotlin:no-line-numbers
188 | val isAbstract: Boolean
189 | ```
190 |
191 | **Change Records**
192 |
193 | `v1.0.0` `first`
194 |
195 | **Function Illustrate**
196 |
197 | > `Class`、`Member` 类型是否包含 `abstract`。
198 |
199 | 对于任意的抽象 `Class`、`Member` 可添加此描述进行确定。
200 |
201 | ## isStrict - i-ext-field
202 |
203 | ```kotlin:no-line-numbers
204 | val isStrict: Boolean
205 | ```
206 |
207 | **Change Records**
208 |
209 | `v1.0.0` `first`
210 |
211 | **Function Illustrate**
212 |
213 | > `Class`、`Member` 类型是否包含 `strictfp`。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/base/rules/NameRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # NameRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class NameRules private constructor()
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是一个模糊 `Class`、`Member` 名称条件实现类。
26 |
27 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
28 |
29 | ## String.isSynthetic - i-ext-method
30 |
31 | ```kotlin:no-line-numbers
32 | fun String.isSynthetic(index: Int): Boolean
33 | ```
34 |
35 | **Change Records**
36 |
37 | `v1.0.0` `first`
38 |
39 | **Function Illustrate**
40 |
41 | > 是否为匿名类的主类调用对象。
42 |
43 | ## String.isOnlySymbols - i-ext-method
44 |
45 | ```kotlin:no-line-numbers
46 | fun String.isOnlySymbols(): Boolean
47 | ```
48 |
49 | **Change Records**
50 |
51 | `v1.0.0` `first`
52 |
53 | **Function Illustrate**
54 |
55 | > 是否只有符号。
56 |
57 | ## String.isOnlyLetters - i-ext-method
58 |
59 | ```kotlin:no-line-numbers
60 | fun String.isOnlyLetters(): Boolean
61 | ```
62 |
63 | **Change Records**
64 |
65 | `v1.0.0` `first`
66 |
67 | **Function Illustrate**
68 |
69 | > 是否只有字母。
70 |
71 | ## String.isOnlyNumbers - i-ext-method
72 |
73 | ```kotlin:no-line-numbers
74 | fun String.isOnlyNumbers(): Boolean
75 | ```
76 |
77 | **Change Records**
78 |
79 | `v1.0.0` `first`
80 |
81 | **Function Illustrate**
82 |
83 | > 是否只有数字。
84 |
85 | ## String.isOnlyLettersNumbers - i-ext-method
86 |
87 | ```kotlin:no-line-numbers
88 | fun String.isOnlyLettersNumbers(): Boolean
89 | ```
90 |
91 | **Change Records**
92 |
93 | `v1.0.0` `first`
94 |
95 | **Function Illustrate**
96 |
97 | > 是否只有字母或数字。
98 |
99 | ## String.isOnlyLowercase - i-ext-method
100 |
101 | ```kotlin:no-line-numbers
102 | fun String.isOnlyLowercase(): Boolean
103 | ```
104 |
105 | **Change Records**
106 |
107 | `v1.0.0` `first`
108 |
109 | **Function Illustrate**
110 |
111 | > 是否只有小写字母。
112 |
113 | 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
114 |
115 | ## String.isOnlyUppercase - i-ext-method
116 |
117 | ```kotlin:no-line-numbers
118 | fun String.isOnlyUppercase(): Boolean
119 | ```
120 |
121 | **Change Records**
122 |
123 | `v1.0.0` `first`
124 |
125 | **Function Illustrate**
126 |
127 | > 是否只有大写字母。
128 |
129 | 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/base/rules/ObjectRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # ObjectRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class ObjectRules private constructor(private val instance: Any)
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 这是一个任意对象条件实现类。
26 |
27 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/classes/rules/ConstructorRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # ConstructorRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class ConstructorRules internal constructor(private val rulesData: ConstructorRulesData) : BaseRules
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > `Constructor` 查找条件实现类。
26 |
27 | ## paramCount - field
28 |
29 | ```kotlin:no-line-numbers
30 | var paramCount: Int
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 设置 `Constructor` 参数个数。
40 |
41 | 你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
42 |
43 | 若参数个数小于零则忽略并使用 `param`。
44 |
45 | ## modifiers - method
46 |
47 | ```kotlin:no-line-numbers
48 | fun modifiers(conditions: ModifierConditions)
49 | ```
50 |
51 | **Change Records**
52 |
53 | `v1.0.0` `first`
54 |
55 | **Function Illustrate**
56 |
57 | > 设置 `Constructor` 标识符筛选条件。
58 |
59 | 可不设置筛选条件。
60 |
61 | ## emptyParam - method
62 |
63 | ```kotlin:no-line-numbers
64 | fun emptyParam()
65 | ```
66 |
67 | **Change Records**
68 |
69 | `v1.0.0` `first`
70 |
71 | **Function Illustrate**
72 |
73 | > 设置 `Constructor` 空参数、无参数。
74 |
75 | ## param - method
76 |
77 | ```kotlin:no-line-numbers
78 | fun param(vararg paramType: Any)
79 | ```
80 |
81 | **Change Records**
82 |
83 | `v1.0.0` `first`
84 |
85 | **Function Illustrate**
86 |
87 | > 设置 `Constructor` 参数。
88 |
89 | 如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
90 |
91 | 如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
92 |
93 | ::: danger
94 |
95 | 无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
96 |
97 | 有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
98 |
99 | :::
100 |
101 | ## param - method
102 |
103 | ```kotlin:no-line-numbers
104 | fun param(conditions: ObjectsConditions)
105 | ```
106 |
107 | **Change Records**
108 |
109 | `v1.0.0` `first`
110 |
111 | **Function Illustrate**
112 |
113 | > 设置 `Constructor` 参数条件。
114 |
115 | ::: danger
116 |
117 | 无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
118 |
119 | 有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
120 |
121 | :::
122 |
123 | ## paramCount - method
124 |
125 | ```kotlin:no-line-numbers
126 | fun paramCount(numRange: IntRange)
127 | ```
128 |
129 | **Change Records**
130 |
131 | `v1.0.0` `first`
132 |
133 | **Function Illustrate**
134 |
135 | > 设置 `Constructor` 参数个数范围。
136 |
137 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
138 |
139 | ## paramCount - method
140 |
141 | ```kotlin:no-line-numbers
142 | fun paramCount(conditions: CountConditions)
143 | ```
144 |
145 | **Change Records**
146 |
147 | `v1.0.0` `first`
148 |
149 | **Function Illustrate**
150 |
151 | > 设置 `Constructor` 参数个数条件。
152 |
153 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/classes/rules/FieldRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # FieldRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class FieldRules internal constructor(private val rulesData: FieldRulesData) : BaseRules
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > `Field` 查找条件实现类。
26 |
27 | ## name - field
28 |
29 | ```kotlin:no-line-numbers
30 | var name: String
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 设置 `Field` 名称。
40 |
41 | ## type - field
42 |
43 | ```kotlin:no-line-numbers
44 | var type: Any?
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.0` `first`
50 |
51 | **Function Illustrate**
52 |
53 | > 设置 `Field` 类型。
54 |
55 | 可不填写类型。
56 |
57 | ## modifiers - method
58 |
59 | ```kotlin:no-line-numbers
60 | fun modifiers(conditions: ModifierConditions)
61 | ```
62 |
63 | **Change Records**
64 |
65 | `v1.0.0` `first`
66 |
67 | **Function Illustrate**
68 |
69 | > 设置 `Field` 标识符筛选条件。
70 |
71 | 可不设置筛选条件。
72 |
73 | ## name - method
74 |
75 | ```kotlin:no-line-numbers
76 | fun name(conditions: NameConditions)
77 | ```
78 |
79 | **Change Records**
80 |
81 | `v1.0.0` `first`
82 |
83 | **Function Illustrate**
84 |
85 | > 设置 `Field` 名称条件。
86 |
87 | ## type - method
88 |
89 | ```kotlin:no-line-numbers
90 | fun type(conditions: ObjectConditions)
91 | ```
92 |
93 | **Change Records**
94 |
95 | `v1.0.0` `first`
96 |
97 | **Function Illustrate**
98 |
99 | > 设置 `Field` 类型条件。
100 |
101 | 可不填写类型。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/classes/rules/MemberRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # MemberRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class MemberRules internal constructor(private val rulesData: MemberRulesData) : BaseRules
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > `Member` 查找条件实现类。
26 |
27 | ## modifiers - method
28 |
29 | ```kotlin:no-line-numbers
30 | fun modifiers(conditions: ModifierConditions)
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 设置 `Member` 标识符筛选条件。
40 |
41 | 可不设置筛选条件。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/classes/rules/MethodRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # MethodRules - class
14 |
15 | ```kotlin:no-line-numbers
16 | class MethodRules internal constructor(private val rulesData: MethodRulesData) : BaseRules
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > `Method` 查找条件实现类。
26 |
27 | ## name - field
28 |
29 | ```kotlin:no-line-numbers
30 | var name: String
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 设置 `Method` 名称。
40 |
41 | ## paramCount - field
42 |
43 | ```kotlin:no-line-numbers
44 | var paramCount: Int
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.0` `first`
50 |
51 | **Function Illustrate**
52 |
53 | > 设置 `Method` 参数个数。
54 |
55 | 你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
56 |
57 | 若参数个数小于零则忽略并使用 `param`。
58 |
59 | ## returnType - field
60 |
61 | ```kotlin:no-line-numbers
62 | var returnType: Any?
63 | ```
64 |
65 | **Change Records**
66 |
67 | `v1.0.0` `first`
68 |
69 | **Function Illustrate**
70 |
71 | > 设置 `Method` 返回值。
72 |
73 | 可不填写返回值。
74 |
75 | ## modifiers - method
76 |
77 | ```kotlin:no-line-numbers
78 | fun modifiers(conditions: ModifierConditions)
79 | ```
80 |
81 | **Change Records**
82 |
83 | `v1.0.0` `first`
84 |
85 | **Function Illustrate**
86 |
87 | > 设置 `Method` 标识符筛选条件。
88 |
89 | 可不设置筛选条件。
90 |
91 | ## emptyParam - method
92 |
93 | ```kotlin:no-line-numbers
94 | fun emptyParam()
95 | ```
96 |
97 | **Change Records**
98 |
99 | `v1.0.0` `first`
100 |
101 | **Function Illustrate**
102 |
103 | > 设置 `Method` 空参数、无参数。
104 |
105 | ## param - method
106 |
107 | ```kotlin:no-line-numbers
108 | fun param(vararg paramType: Any)
109 | ```
110 |
111 | **Change Records**
112 |
113 | `v1.0.0` `first`
114 |
115 | **Function Illustrate**
116 |
117 | > 设置 `Method` 参数。
118 |
119 | 如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
120 |
121 | 如果 `Method` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
122 |
123 | ::: danger
124 |
125 | 无参 **Method** 请使用 **emptyParam** 设置查找条件。
126 |
127 | 有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
128 |
129 | :::
130 |
131 | ## param - method
132 |
133 | ```kotlin:no-line-numbers
134 | fun param(conditions: ObjectsConditions)
135 | ```
136 |
137 | **Change Records**
138 |
139 | `v1.0.0` `first`
140 |
141 | **Function Illustrate**
142 |
143 | > 设置 `Method` 参数条件。
144 |
145 | ::: danger
146 |
147 | 无参 **Method** 请使用 **emptyParam** 设置查找条件。
148 |
149 | 有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
150 |
151 | :::
152 |
153 | ## name - method
154 |
155 | ```kotlin:no-line-numbers
156 | fun name(conditions: NameConditions)
157 | ```
158 |
159 | **Change Records**
160 |
161 | `v1.0.0` `first`
162 |
163 | **Function Illustrate**
164 |
165 | > 设置 `Method` 名称条件。
166 |
167 | ## paramCount - method
168 |
169 | ```kotlin:no-line-numbers
170 | fun paramCount(numRange: IntRange)
171 | ```
172 |
173 | **Change Records**
174 |
175 | `v1.0.0` `first`
176 |
177 | **Function Illustrate**
178 |
179 | > 设置 `Method` 参数个数范围。
180 |
181 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
182 |
183 | ## paramCount - method
184 |
185 | ```kotlin:no-line-numbers
186 | fun paramCount(conditions: CountConditions)
187 | ```
188 |
189 | **Change Records**
190 |
191 | `v1.0.0` `first`
192 |
193 | **Function Illustrate**
194 |
195 | > 设置 `Method` 参数个数条件。
196 |
197 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
198 |
199 | ## returnType - method
200 |
201 | ```kotlin:no-line-numbers
202 | fun returnType(conditions: ObjectConditions)
203 | ```
204 |
205 | **Change Records**
206 |
207 | `v1.0.0` `first`
208 |
209 | **Function Illustrate**
210 |
211 | > 设置 `Method` 返回值条件。
212 |
213 | 可不填写返回值。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/finder/classes/rules/result/MemberRulesResult.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # MemberRulesResult - class
14 |
15 | ```kotlin:no-line-numbers
16 | class MemberRulesResult internal constructor(private val rulesData: MemberRulesData)
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.0` `first`
22 |
23 | **Function Illustrate**
24 |
25 | > 当前 `Member` 查找条件结果实现类。
26 |
27 | ## none - method
28 |
29 | ```kotlin:no-line-numbers
30 | fun none(): MemberRulesResult
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.0` `first`
36 |
37 | **Function Illustrate**
38 |
39 | > 设置当前 `Member` 在查找条件中个数为 `0`。
40 |
41 | ## count - method
42 |
43 | ```kotlin:no-line-numbers
44 | fun count(num: Int): MemberRulesResult
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.0` `first`
50 |
51 | **Function Illustrate**
52 |
53 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数。
54 |
55 | ## count - method
56 |
57 | ```kotlin:no-line-numbers
58 | fun count(numRange: IntRange): MemberRulesResult
59 | ```
60 |
61 | **Change Records**
62 |
63 | `v1.0.0` `first`
64 |
65 | **Function Illustrate**
66 |
67 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数范围。
68 |
69 | ## count - method
70 |
71 | ```kotlin:no-line-numbers
72 | fun count(conditions: CountConditions): MemberRulesResult
73 | ```
74 |
75 | **Change Records**
76 |
77 | `v1.0.0` `first`
78 |
79 | **Function Illustrate**
80 |
81 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数条件。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/log/YLog.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # YLog - object
14 |
15 | ```kotlin:no-line-numbers
16 | object YLog
17 | ```
18 |
19 | **Change Records**
20 |
21 | `v1.0.3` `added`
22 |
23 | **Function Illustrate**
24 |
25 | > 全局 Log 管理类。
26 |
27 | ## Configs - object
28 |
29 | ```kotlin:no-line-numbers
30 | object Configs
31 | ```
32 |
33 | **Change Records**
34 |
35 | `v1.0.3` `added`
36 |
37 | **Function Illustrate**
38 |
39 | > 配置 `YLog`。
40 |
41 | ### tag - field
42 |
43 | ```kotlin:no-line-numbers
44 | var tag: String
45 | ```
46 |
47 | **Change Records**
48 |
49 | `v1.0.3` `added`
50 |
51 | **Function Illustrate**
52 |
53 | > 这是一个调试日志的全局标识。
54 |
55 | 默认文案为 `YukiReflection`。
56 |
57 | 你可以修改为你自己的文案。
58 |
59 | ### isEnable - field
60 |
61 | ```kotlin:no-line-numbers
62 | var isEnable: Boolean
63 | ```
64 |
65 | **Change Records**
66 |
67 | `v1.0.3` `added`
68 |
69 | **Function Illustrate**
70 |
71 | > 是否启用调试日志的输出功能。
72 |
73 | 关闭后将会停用 `YukiReflection` 对全部日志的输出。
74 |
75 | 当 `isEnable` 关闭后 `YukiReflection.Configs.isDebug` 也将同时关闭。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/type/android/ComponentTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # ComponentTypeFactory - kt
14 |
15 | **Change Records**
16 |
17 | `v1.0.0` `first`
18 |
19 | **Function Illustrate**
20 |
21 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
22 |
23 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/ComponentTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/type/android/GraphicsTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # GraphicsTypeFactory - kt
14 |
15 | **Change Records**
16 |
17 | `v1.0.0` `first`
18 |
19 | **Function Illustrate**
20 |
21 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
22 |
23 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/GraphicsTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/type/android/ViewTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # ViewTypeFactory - kt
14 |
15 | **Change Records**
16 |
17 | `v1.0.0` `first`
18 |
19 | **Function Illustrate**
20 |
21 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
22 |
23 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/ViewTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/type/defined/DefinedTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # DefinedTypeFactory - kt
14 |
15 | **Change Records**
16 |
17 | `v1.0.0` `first`
18 |
19 | **Function Illustrate**
20 |
21 | > 这是一个内部类型的定义常量类,主要用于反射 API 相关用法的延伸。
22 |
23 | ## VagueType - field
24 |
25 | ```kotlin:no-line-numbers
26 | val VagueType: Class<*>
27 | ```
28 |
29 | **Change Records**
30 |
31 | `v1.0.0` `first`
32 |
33 | **Function Illustrate**
34 |
35 | > 得到模糊类型。
--------------------------------------------------------------------------------
/docs-source/src/en/api/public/com/highcapable/yukireflection/type/java/VariableTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | ::: warning
6 |
7 | The English translation of this page has not been completed, you are welcome to contribute translations to us.
8 |
9 | You can use the **Chrome Translation Plugin** to translate entire pages for reference.
10 |
11 | :::
12 |
13 | # VariableTypeFactory - kt
14 |
15 | **Change Records**
16 |
17 | `v1.0.0` `first`
18 |
19 | **Function Illustrate**
20 |
21 | > 这是一个预置反射类型的常量类,主要为 Java 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
22 |
23 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/java/VariableTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/en/config/api-example.md:
--------------------------------------------------------------------------------
1 | # API Basic Configs
2 |
3 | > The basic configuration method of `YukiReflection` is introduced here.
4 |
5 | `YukiReflection` can be used directly without some complex configuration, and does not conflict with Java's native Reflection API.
6 |
7 | You can configure some functions of `YukiReflection` before using it.
8 |
9 | ## Get the API Tag & Version
10 |
11 | You can get the current tag and version of `YukiReflection` as follows.
12 |
13 | > The following example
14 |
15 | ```kotlin
16 | // Get the tag
17 | val tag = YukiReflection.TAG
18 | // Get the version
19 | val version = YukiReflection.VERSION
20 | ```
21 |
22 | You can judge the difference between different versions or display it in the about information by obtaining the version.
23 |
24 | ::: tip
25 |
26 | For more functions, please refer to [YukiReflection](../api/public/com/highcapable/yukireflection/YukiReflection).
27 |
28 | :::
29 |
30 | ## Configure API Related Functions
31 |
32 | You can configure related functions through `YukiReflection.configs { ... }` method or `YukiReflection.Configs`.
33 |
34 | ### Custom Debug Log Tag
35 |
36 | You can use the following methods to customize the tag of the debug log.
37 |
38 | Logs inside the API will be printed using this tag.
39 |
40 | > The following example
41 |
42 | ```kotlin
43 | // Via the configs method
44 | YukiReflection.configs {
45 | debugLog {
46 | tag = "YourCustomTag"
47 | }
48 | }
49 | // Set directly
50 | YLog.Configs.tag = "YourCustomTag"
51 | ```
52 |
53 | ### Enable or Disable Debug Mode
54 |
55 | You can use the following methods to enable or disable Debug mode.
56 |
57 | The Debug mode is disabled by default, and when enabled, detailed logs (such as the time spent on the reflective search function) will be printed to the console.
58 |
59 | > The following example
60 |
61 | ```kotlin
62 | // Via the configs method
63 | YukiReflection.configs {
64 | isDebug = true
65 | }
66 | // Set directly
67 | YukiReflection.Configs.isDebug = true
68 | ```
69 |
70 | ### Enable or Disable Debug Logs
71 |
72 | You can use the following methods to enable or disable debug logs.
73 |
74 | This function is enabled by default, and disable will stop `YukiReflection` output all logs.
75 |
76 | > The following example
77 |
78 | ```kotlin
79 | // Via the configs method
80 | YukiReflection.configs {
81 | debugLog {
82 | isEnable = true
83 | }
84 | }
85 | // Set directly
86 | YLog.Configs.isEnable = true
87 | ```
88 |
89 | ### Use the configs Method to Configure
90 |
91 | In order to configure multiple features at once, you can directly use the `YukiReflection.configs { ... }` method to configure.
92 |
93 | > The following example
94 |
95 | ```kotlin
96 | YukiReflection.configs {
97 | debugLog {
98 | tag = "YourCustomTag"
99 | isEnable = true
100 | }
101 | isDebug = true
102 | }
103 | ```
104 |
105 | ::: tip
106 |
107 | For more functions, please refer to [YukiReflection.configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-method) method, [YukiReflection.Configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-object).
108 |
109 | :::
--------------------------------------------------------------------------------
/docs-source/src/en/guide/home.md:
--------------------------------------------------------------------------------
1 | # Introduce
2 |
3 | > `YukiReflection` is a Reflection API based on the Java and Android platform.
4 |
5 | ## Background
6 |
7 | This is a set of simple and efficient Reflection API rebuilt based on Java native Reflection API using Kotlin.
8 |
9 | `YukiReflection` is also the core functionality that [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI) is using.
10 |
11 | The name is taken from ["ももくり" heroine Yuki Kurihara](https://www.bilibili.com/bangumi/play/ss5016).
12 |
13 | ## Usage
14 |
15 | `YukiReflection` is fully built with Kotlin **lambda** syntax.
16 |
17 | It can replace [Java's native Reflection API](https://www.oracle.com/technical-resources/articles/java/javareflection.html) and implement a more complete reflection solution in a more human-friendly language.
18 |
19 | ## Language Requirement
20 |
21 | Please use Kotlin, the code composition of the API part is also compatible with Java, but the implementation of the basic reflection scene **may not be used at all**.
22 |
23 | All Demo sample codes in the document will be described using Kotlin, if you don’t know how to use Kotlin at all, you may not be able to use `YukiReflection`.
24 |
25 | ## Source of Inspiration
26 |
27 | `YukiReflection` was originally the core function integrated in the [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI) project, and now it is decoupled so that this Reflection API can be used in any Java and Android platform project.
28 |
29 | Now, we only need to write a small amount of code to implement a simple reflection call.
30 |
31 | With Kotlin elegant **lambda** and `YukiReflection`, you can make your reflection logic more beautiful and clear.
32 |
33 | > The following example
34 |
35 | :::: code-group
36 | ::: code-group-item Yuki Reflection
37 |
38 | ```kotlin
39 | "android.os.SystemProperties".toClass()
40 | .method {
41 | name = "get"
42 | param(StringClass, StringClass)
43 | }.get().call("ro.system.build.fingerprint", "none")
44 | ```
45 |
46 | :::
47 | ::: code-group-item Java Reflection
48 |
49 | ```kotlin
50 | Class.forName("android.os.SystemProperties")
51 | .getDeclaredMethod("get", String::class.java, String::class.java)
52 | .apply { isAccessible = true }
53 | .invoke(null, "ro.system.build.fingerprint", "none")
54 | ```
55 |
56 | :::
57 | ::::
--------------------------------------------------------------------------------
/docs-source/src/en/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | title: Home
4 | heroImage: /images/logo.png
5 | actions:
6 | - text: Get Started
7 | link: /en/guide/home
8 | type: primary
9 | - text: Changelog
10 | link: /en/about/changelog
11 | type: secondary
12 | features:
13 | - title: Light and Elegant
14 | details: A powerful, elegant, beautiful API built with Kotlin lambda can help you quickly implement bytecode finding and reflection functions.
15 | - title: Cross-Platform Available
16 | details: Not only the Android platform, it is highly compatible with the Java API and can be used on any Kotlin on JVM project, wherever Java is available.
17 | - title: Quickly Started
18 | details: Simple and easy to use it now! Do not need complex configuration and full development experience, Integrate dependencies and enjoy yourself.
19 | footer: Apache-2.0 License | Copyright (C) 2019 HighCapable
20 | ---
21 |
22 | ### Bring it on! Let reflection become poetic and picturesque
23 |
24 | ```java
25 | public class World {
26 |
27 | private void sayHello(String content) {
28 | System.out.println("Hello " + content + "!");
29 | }
30 | }
31 | ```
32 |
33 | ```kotlin
34 | val newWorld = World()
35 | classOf().method {
36 | name = "sayHello"
37 | param(StringClass)
38 | type = UnitType
39 | }.get(newWorld).call("YukiReflection")
40 | ```
--------------------------------------------------------------------------------
/docs-source/src/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | navbar: false
4 | sidebar: false
5 | title: null
6 | heroAlt: null
7 | heroText: null
8 | tagline: Select a language
9 | actions:
10 | - text: English
11 | link: /en/
12 | type: secondary
13 | - text: 简体中文
14 | link: /zh-cn/
15 | type: secondary
16 | footer: Apache-2.0 License | Copyright (C) 2019 HighCapable
17 | ---
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/about/about.md:
--------------------------------------------------------------------------------
1 | # 关于此文档
2 |
3 | > 此文档由 [VuePress](https://v2.vuepress.vuejs.org/zh) 强力驱动。
4 |
5 | ## 许可证
6 |
7 | [Apache-2.0](https://github.com/HighCapable/YukiReflection/blob/master/LICENSE)
8 |
9 | ```:no-line-numbers
10 | Apache License Version 2.0
11 |
12 | Copyright (C) 2019 HighCapable
13 |
14 | Licensed under the Apache License, Version 2.0 (the "License");
15 | you may not use this file except in compliance with the License.
16 | You may obtain a copy of the License at
17 |
18 | https://www.apache.org/licenses/LICENSE-2.0
19 |
20 | Unless required by applicable law or agreed to in writing, software
21 | distributed under the License is distributed on an "AS IS" BASIS,
22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | See the License for the specific language governing permissions and
24 | limitations under the License.
25 | ```
26 |
27 | 版权所有 © 2019 HighCapable
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/about/changelog.md:
--------------------------------------------------------------------------------
1 | # 更新日志
2 |
3 | > 这里记录了 `YukiReflection` 的版本更新历史。
4 |
5 | ::: danger
6 |
7 | 我们只会对最新的 API 版本进行维护,若你正在使用过时的 API 版本则代表你自愿放弃一切维护的可能性。
8 |
9 | :::
10 |
11 | ### 1.0.3 | 2023.10.07
12 |
13 | - 许可协议由 `MIT` 变更为 `Apache-2.0`,在此之后的版本将由此许可协议进行分发,您在使用此版本后应变更相关许可协议
14 | - 将依赖库的类型由 **Android Library** (aar) 修改回 **Java Library** (jar)
15 | - 适配并支持原生 Java 平台 (部分功能仅限 Android 平台)
16 | - 修复 [fix get interfaces of class](https://github.com/HighCapable/YukiHookAPI/pull/38) 问题并合并到 `YukiReflection`
17 | - 作废了 ~~`isAllowPrintingLogs`~~,请开始使用 `debugLog` 方法
18 | - 新增 `YukiReflection.TAG`
19 | - 作废了 ~~`YukiReflection.API_VERSION_NAME`~~、~~`YukiReflection.API_VERSION_CODE`~~,统一合并到 `YukiReflection.VERSION`
20 | - 重构方法查找中的 `remendy` 功能,现在可以对其进行分步打印异常
21 | - 多重方法查找结果类型由 `HashSet` 改为 `MutableList`
22 | - 新增使用 `method()`、`constructor()`、`field()` 可直接获取到类中的所有对象功能
23 | - `constructor()` 的行为不再是 `constructor { emptyParam() }`
24 | - 新增 `lazyClass`、`lazyClassOrNull` 方法,可延迟装载 `Class`
25 |
26 | ### 1.0.2 | 2023.04.25
27 |
28 | - 修复一个严重问题,`Member` 缓存未生效且持续存储最终引发 APP 内存溢出 (OOM),感谢 [Art-Chen](https://github.com/Art-Chen)
29 | - 移除 `Member` 的直接缓存功能并作废 ~~`YukiReflection.Configs.isEnableMemberCache`~~,保留 `Class` 的缓存功能
30 | - 对接查找功能到 `Sequence`,优化 `Member` 的查找速度与性能
31 |
32 | ### 1.0.1 | 2023.04.16
33 |
34 | - 将依赖库的类型由 **Java Library** (jar) 修改为 **Android Library** (aar)
35 | - 移除了 Android `type` 中的错误 `Class` 对象声明
36 |
37 | ### 1.0.0 | 2023.01.26
38 |
39 | - 首个版本提交至 Maven
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/about/contacts.md:
--------------------------------------------------------------------------------
1 | # 联系我们
2 |
3 | > 如在使用中有任何问题,或有任何建设性的建议,都可以联系我们。
4 |
5 | 加入我们的开发者群组。
6 |
7 | - [点击加入 Telegram 群组](https://t.me/YukiReflection)
8 | - [点击加入 Telegram 群组 (开发者)](https://t.me/HighCapable_Dev)
9 | - [点击加入 QQ 群 (开发者)](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
10 |
11 | 在 **酷安** 找到我 [@星夜不荟](http://www.coolapk.com/u/876977)。
12 |
13 | ## 助力维护
14 |
15 | 感谢您选择并使用 `YukiReflection`,如有代码相关的建议和请求,可在 GitHub 提交 Pull Request。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/home.md:
--------------------------------------------------------------------------------
1 | ---
2 | next:
3 | text: Public API
4 | link: /zh-cn/api/public/com/highcapable/yukireflection/YukiReflection
5 | ---
6 |
7 | # 文档介绍
8 |
9 | > 这里的文档将同步最新 API 版本的相关用法,请保持 `YukiReflection` 为最新版本以使用最新版本的功能。
10 |
11 | ## 功能描述说明
12 |
13 | > 功能描述主要介绍当前 API 的相关用法和用途。
14 |
15 | ## 功能示例说明
16 |
17 | > 功能示例主要展示了当前 API 的基本用法示例,可供参考。
18 |
19 | ## 变更记录说明
20 |
21 | 首个版本的功能将标记为 `v` `添加`;
22 |
23 | 后期新增加的功能将标记为 `v` `新增`;
24 |
25 | 后期修改的功能将被追加为 `v` `修改`;
26 |
27 | 后期被作废的功能将标记为 `v` `作废` 并会标注删除线;
28 |
29 | 后期被删除的功能将标记为 `v` `移除` 并会标注删除线。
30 |
31 | ## 相关符号说明
32 |
33 | - *kt* Kotlin Static File
34 |
35 | - *annotation* 注解
36 |
37 | - *interface* 接口
38 |
39 | - *object* 类 (单例)
40 |
41 | - *class* 类
42 |
43 | - *field* 变量或 `get`、`set` 方法或只读的 `get` 方法
44 |
45 | - *method* 方法
46 |
47 | - *enum* Enum 常量
48 |
49 | - *ext-field* 扩展的变量 (全局)
50 |
51 | - *ext-method* 扩展的方法 (全局)
52 |
53 | - *i-ext-field* 扩展的变量 (调用域限制)
54 |
55 | - *i-ext-method* 扩展的方法 (调用域限制)
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/YukiReflection.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # YukiReflection - object
6 |
7 | ```kotlin:no-line-numbers
8 | object YukiReflection
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是 `YukiReflection` 的装载调用类。
18 |
19 | ## TAG - field
20 |
21 | ```kotlin:no-line-numbers
22 | const val TAG: String
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.3` `新增`
28 |
29 | **功能描述**
30 |
31 | > 获取当前 `YukiReflection` 的名称 (标签)。
32 |
33 | ## VERSION - field
34 |
35 | ```kotlin:no-line-numbers
36 | const val VERSION: String
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.3` `新增`
42 |
43 | **功能描述**
44 |
45 | > 获取当前 `YukiReflection` 的版本。
46 |
47 | API_VERSION_NAME - field
48 |
49 | **变更记录**
50 |
51 | `v1.0.0` `添加`
52 |
53 | `v1.0.3` `作废`
54 |
55 | 不再区分版本名称和版本号,请迁移到 `VERSION`
56 |
57 | API_VERSION_CODE - field
58 |
59 | **变更记录**
60 |
61 | `v1.0.0` `添加`
62 |
63 | `v1.0.3` `作废`
64 |
65 | 不再区分版本名称和版本号,请迁移到 `VERSION`
66 |
67 | ## Configs - object
68 |
69 | ```kotlin:no-line-numbers
70 | object Configs
71 | ```
72 |
73 | **变更记录**
74 |
75 | `v1.0.0` `添加`
76 |
77 | **功能描述**
78 |
79 | > 对 API 相关功能的配置类。
80 |
81 | ### debugLog - method
82 |
83 | ```kotlin:no-line-numbers
84 | inline fun debugLog(initiate: YLog.Configs.() -> Unit)
85 | ```
86 |
87 | **变更记录**
88 |
89 | `v1.0.3` `新增`
90 |
91 | **功能描述**
92 |
93 | > 配置 `YLog.Configs` 相关参数。
94 |
95 | debugTag - field
96 |
97 | **变更记录**
98 |
99 | `v1.0.0` `添加`
100 |
101 | `v1.0.3` `作废`
102 |
103 | 请迁移到 `debugLog`
104 |
105 | ### isDebug - field
106 |
107 | ```kotlin:no-line-numbers
108 | var isDebug: Boolean
109 | ```
110 |
111 | **变更记录**
112 |
113 | `v1.0.0` `添加`
114 |
115 | **功能描述**
116 |
117 | > 是否启用 Debug 模式。
118 |
119 | 默认不启用,启用后将交由日志输出管理器打印详细日志 (例如反射查找功能的耗时) 到控制台。
120 |
121 | isAllowPrintingLogs - field
122 |
123 | **变更记录**
124 |
125 | `v1.0.0` `添加`
126 |
127 | `v1.0.3` `作废`
128 |
129 | 请迁移到 `debugLog`
130 |
131 | isEnableMemberCache - field
132 |
133 | **变更记录**
134 |
135 | `v1.0.0` `添加`
136 |
137 | `v1.0.2` `作废`
138 |
139 | `Member` 的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
140 |
141 | ## configs - method
142 |
143 | ```kotlin:no-line-numbers
144 | inline fun configs(initiate: Configs.() -> Unit)
145 | ```
146 |
147 | **变更记录**
148 |
149 | `v1.0.0` `添加`
150 |
151 | **功能描述**
152 |
153 | > 对 `Configs` 类实现了一个 **lambda** 方法体。
154 |
155 | 你可以轻松地调用它进行配置。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/bean/CurrentClass.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # CurrentClass - class
6 |
7 | ```kotlin:no-line-numbers
8 | class CurrentClass internal constructor(private val classSet: Class<*>, internal val instance: Any)
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 当前实例的类操作对象。
18 |
19 | ## name - field
20 |
21 | ```kotlin:no-line-numbers
22 | val name: String
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 获得当前 `classSet` 的 `Class.getName`。
32 |
33 | ## simpleName - field
34 |
35 | ```kotlin:no-line-numbers
36 | val simpleName: String
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.0` `添加`
42 |
43 | **功能描述**
44 |
45 | > 获得当前 `classSet` 的 `Class.getSimpleName`。
46 |
47 | ## generic - method
48 |
49 | ```kotlin:no-line-numbers
50 | fun generic(): GenericClass?
51 | ```
52 |
53 | **变更记录**
54 |
55 | `v1.0.0` `添加`
56 |
57 | **功能描述**
58 |
59 | > 获得当前实例中的泛型父类。
60 |
61 | 如果当前实例不存在泛型将返回 `null`。
62 |
63 | ## generic - method
64 |
65 | ```kotlin:no-line-numbers
66 | inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
67 | ```
68 |
69 | **变更记录**
70 |
71 | `v1.0.0` `添加`
72 |
73 | **功能描述**
74 |
75 | > 获得当前实例中的泛型父类。
76 |
77 | 如果当前实例不存在泛型将返回 `null`。
78 |
79 | ## superClass - method
80 |
81 | ```kotlin:no-line-numbers
82 | fun superClass(): SuperClass
83 | ```
84 |
85 | **变更记录**
86 |
87 | `v1.0.0` `添加`
88 |
89 | **功能描述**
90 |
91 | > 调用父类实例。
92 |
93 | ## field - method
94 |
95 | ```kotlin:no-line-numbers
96 | inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
97 | ```
98 |
99 | **变更记录**
100 |
101 | `v1.0.0` `添加`
102 |
103 | **功能描述**
104 |
105 | > 调用当前实例中的变量。
106 |
107 | ## method - method
108 |
109 | ```kotlin:no-line-numbers
110 | inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
111 | ```
112 |
113 | **变更记录**
114 |
115 | `v1.0.0` `添加`
116 |
117 | **功能描述**
118 |
119 | > 调用当前实例中的方法。
120 |
121 | ## SuperClass - class
122 |
123 | ```kotlin:no-line-numbers
124 | inner class SuperClass internal constructor(private val superClassSet: Class<*>)
125 | ```
126 |
127 | **变更记录**
128 |
129 | `v1.0.0` `添加`
130 |
131 | **功能描述**
132 |
133 | > 当前类的父类实例的类操作对象。
134 |
135 | ### name - field
136 |
137 | ```kotlin:no-line-numbers
138 | val name: String
139 | ```
140 |
141 | **变更记录**
142 |
143 | `v1.0.0` `添加`
144 |
145 | **功能描述**
146 |
147 | > 获得当前 `classSet` 中父类的 `Class.getName`。
148 |
149 | ### simpleName - field
150 |
151 | ```kotlin:no-line-numbers
152 | val simpleName: String
153 | ```
154 |
155 | **变更记录**
156 |
157 | `v1.0.0` `添加`
158 |
159 | **功能描述**
160 |
161 | > 获得当前 `classSet` 中父类的 `Class.getSimpleName`。
162 |
163 | ### generic - method
164 |
165 | ```kotlin:no-line-numbers
166 | fun generic(): GenericClass?
167 | ```
168 |
169 | **变更记录**
170 |
171 | `v1.0.0` `添加`
172 |
173 | **功能描述**
174 |
175 | > 获得当前实例父类中的泛型父类。
176 |
177 | 如果当前实例不存在泛型将返回 `null`。
178 |
179 | ### generic - method
180 |
181 | ```kotlin:no-line-numbers
182 | inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
183 | ```
184 |
185 | **变更记录**
186 |
187 | `v1.0.0` `添加`
188 |
189 | **功能描述**
190 |
191 | > 获得当前实例父类中的泛型父类。
192 |
193 | 如果当前实例不存在泛型将返回 `null`。
194 |
195 | ### field - method
196 |
197 | ```kotlin:no-line-numbers
198 | inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
199 | ```
200 |
201 | **变更记录**
202 |
203 | `v1.0.0` `添加`
204 |
205 | **功能描述**
206 |
207 | > 调用父类实例中的变量。
208 |
209 | ### method - method
210 |
211 | ```kotlin:no-line-numbers
212 | inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
213 | ```
214 |
215 | **变更记录**
216 |
217 | `v1.0.0` `添加`
218 |
219 | **功能描述**
220 |
221 | > 调用父类实例中的方法。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/bean/GenericClass.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # GenericClass - class
6 |
7 | ```kotlin:no-line-numbers
8 | class GenericClass internal constructor(private val type: ParameterizedType)
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 当前 `Class` 的泛型父类操作对象。
18 |
19 | ## argument - method
20 |
21 | ```kotlin:no-line-numbers
22 | fun argument(index: Int): Class<*>?
23 | ```
24 |
25 | ```kotlin:no-line-numbers
26 | inline fun argument(index: Int): Class?
27 | ```
28 |
29 | **变更记录**
30 |
31 | `v1.0.0` `添加`
32 |
33 | `v1.0.3` `修改`
34 |
35 | 方法的返回值可为 `null`
36 |
37 | **功能描述**
38 |
39 | > 获得泛型参数数组下标的 `Class` 实例。
40 |
41 | ::: warning
42 |
43 | 在运行时局部变量的泛型会被擦除,获取不到时将会返回 **null**。
44 |
45 | :::
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/bean/VariousClass.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # VariousClass - class
6 |
7 | ```kotlin:no-line-numbers
8 | class VariousClass(private vararg val name: String)
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是一个不确定性 `Class` 类名装载器,通过 `name` 装载 `Class` 名称数组。
18 |
19 | ## get - method
20 |
21 | ```kotlin:no-line-numbers
22 | fun get(loader: ClassLoader? = null, initialize: Boolean): Class<*>
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 获取匹配的实体类。
32 |
33 | 使用当前 `loader` 装载目标 `Class`。
34 |
35 | ## getOrNull - method
36 |
37 | ```kotlin:no-line-numbers
38 | fun getOrNull(loader: ClassLoader? = null, initialize: Boolean): Class<*>?
39 | ```
40 |
41 | **变更记录**
42 |
43 | `v1.0.0` `添加`
44 |
45 | **功能描述**
46 |
47 | > 获取匹配的实体类。
48 |
49 | 使用当前 `loader` 装载目标 `Class`。
50 |
51 | 匹配不到 `Class` 会返回 `null`,不会抛出异常。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/base/BaseFinder.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # BaseFinder - class
6 |
7 | ```kotlin:no-line-numbers
8 | abstract class BaseFinder
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是 `Class` 与 `Member` 查找类功能的基本类实现。
18 |
19 | ## BaseFinder.IndexTypeCondition - class
20 |
21 | ```kotlin:no-line-numbers
22 | inner class IndexTypeCondition internal constructor(private val type: IndexConfigType)
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 字节码下标筛选实现类。
32 |
33 | ### index - method
34 |
35 | ```kotlin:no-line-numbers
36 | fun index(num: Int)
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.0` `添加`
42 |
43 | **功能描述**
44 |
45 | > 设置下标。
46 |
47 | 若 `index` 小于零则为倒序,此时可以使用 `IndexTypeConditionSort.reverse` 方法实现。
48 |
49 | 可使用 `IndexTypeConditionSort.first` 和 `IndexTypeConditionSort.last` 设置首位和末位筛选条件。
50 |
51 | ### index - method
52 |
53 | ```kotlin:no-line-numbers
54 | fun index(): IndexTypeConditionSort
55 | ```
56 |
57 | **变更记录**
58 |
59 | `v1.0.0` `添加`
60 |
61 | **功能描述**
62 |
63 | > 得到下标。
64 |
65 | ### IndexTypeConditionSort - class
66 |
67 | ```kotlin:no-line-numbers
68 | inner class IndexTypeConditionSort internal constructor()
69 | ```
70 |
71 | **变更记录**
72 |
73 | `v1.0.0` `添加`
74 |
75 | **功能描述**
76 |
77 | > 字节码下标排序实现类。
78 |
79 | #### first - method
80 |
81 | ```kotlin:no-line-numbers
82 | fun first()
83 | ```
84 |
85 | **变更记录**
86 |
87 | `v1.0.0` `添加`
88 |
89 | **功能描述**
90 |
91 | > 设置满足条件的第一个。
92 |
93 | #### last - method
94 |
95 | ```kotlin:no-line-numbers
96 | fun last()
97 | ```
98 |
99 | **变更记录**
100 |
101 | `v1.0.0` `添加`
102 |
103 | **功能描述**
104 |
105 | > 设置满足条件的最后一个。
106 |
107 | #### reverse - method
108 |
109 | ```kotlin:no-line-numbers
110 | fun reverse(num: Int)
111 | ```
112 |
113 | **变更记录**
114 |
115 | `v1.0.0` `添加`
116 |
117 | **功能描述**
118 |
119 | > 设置倒序下标。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/base/rules/CountRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # CountRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class CountRules private constructor()
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是一个模糊 `Class`、`Member` 数组 (下标) 个数条件实现类。
18 |
19 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
20 |
21 | ## Int.isZero - i-ext-method
22 |
23 | ```kotlin:no-line-numbers
24 | fun Int.isZero(): Boolean
25 | ```
26 |
27 | **变更记录**
28 |
29 | `v1.0.0` `添加`
30 |
31 | **功能描述**
32 |
33 | > 是否为 0。
34 |
35 | ## Int.moreThan - i-ext-method
36 |
37 | ```kotlin:no-line-numbers
38 | fun Int.moreThan(count: Int): Boolean
39 | ```
40 |
41 | **变更记录**
42 |
43 | `v1.0.0` `添加`
44 |
45 | **功能描述**
46 |
47 | > 大于 `count`。
48 |
49 | ## Int.lessThan - i-ext-method
50 |
51 | ```kotlin:no-line-numbers
52 | fun Int.lessThan(count: Int): Boolean
53 | ```
54 |
55 | **变更记录**
56 |
57 | `v1.0.0` `添加`
58 |
59 | **功能描述**
60 |
61 | > 小于 `count`。
62 |
63 | ## Int.inInterval - i-ext-method
64 |
65 | ```kotlin:no-line-numbers
66 | fun Int.inInterval(countRange: IntRange): Boolean
67 | ```
68 |
69 | **变更记录**
70 |
71 | `v1.0.0` `添加`
72 |
73 | **功能描述**
74 |
75 | > 在 `countRange` 区间 A ≤ this ≤ B。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/base/rules/ModifierRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # ModifierRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class ModifierRules private constructor()
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是一个 `Class`、`Member` 描述符条件实现类。
18 |
19 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
20 |
21 | ## isPublic - i-ext-field
22 |
23 | ```kotlin:no-line-numbers
24 | val isPublic: Boolean
25 | ```
26 |
27 | **变更记录**
28 |
29 | `v1.0.0` `添加`
30 |
31 | **功能描述**
32 |
33 | > `Class`、`Member` 类型是否包含 `public`。
34 |
35 | ## isPrivate - i-ext-field
36 |
37 | ```kotlin:no-line-numbers
38 | val isPrivate: Boolean
39 | ```
40 |
41 | **变更记录**
42 |
43 | `v1.0.0` `添加`
44 |
45 | **功能描述**
46 |
47 | > `Class`、`Member` 类型是否包含 `private`。
48 |
49 | ## isProtected - i-ext-field
50 |
51 | ```kotlin:no-line-numbers
52 | val isProtected: Boolean
53 | ```
54 |
55 | **变更记录**
56 |
57 | `v1.0.0` `添加`
58 |
59 | **功能描述**
60 |
61 | > `Class`、`Member` 类型是否包含 `protected`。
62 |
63 | ## isStatic - i-ext-field
64 |
65 | ```kotlin:no-line-numbers
66 | val isStatic: Boolean
67 | ```
68 |
69 | **变更记录**
70 |
71 | `v1.0.0` `添加`
72 |
73 | **功能描述**
74 |
75 | > `Class`、`Member` 类型是否包含 `static`。
76 |
77 | 对于任意的静态 `Class`、`Member` 可添加此描述进行确定。
78 |
79 | ::: warning
80 |
81 | Kotlin → Jvm 后的 **object** 类中的方法并不是静态的。
82 |
83 | :::
84 |
85 | ## isFinal - i-ext-field
86 |
87 | ```kotlin:no-line-numbers
88 | val isFinal: Boolean
89 | ```
90 |
91 | **变更记录**
92 |
93 | `v1.0.0` `添加`
94 |
95 | **功能描述**
96 |
97 | > `Class`、`Member` 类型是否包含 `final`。
98 |
99 | ::: warning
100 |
101 | Kotlin → Jvm 后没有 **open** 符号标识的 **Class**、**Member** 和没有任何关联的 **Class**、**Member** 都将为 **final**。
102 |
103 | :::
104 |
105 | ## isSynchronized - i-ext-field
106 |
107 | ```kotlin:no-line-numbers
108 | val isSynchronized: Boolean
109 | ```
110 |
111 | **变更记录**
112 |
113 | `v1.0.0` `添加`
114 |
115 | **功能描述**
116 |
117 | > `Class`、`Member` 类型是否包含 `synchronized`。
118 |
119 | ## isVolatile - i-ext-field
120 |
121 | ```kotlin:no-line-numbers
122 | val isVolatile: Boolean
123 | ```
124 |
125 | **变更记录**
126 |
127 | `v1.0.0` `添加`
128 |
129 | **功能描述**
130 |
131 | > `Field` 类型是否包含 `volatile`。
132 |
133 | ## isTransient - i-ext-field
134 |
135 | ```kotlin:no-line-numbers
136 | val isTransient: Boolean
137 | ```
138 |
139 | **变更记录**
140 |
141 | `v1.0.0` `添加`
142 |
143 | **功能描述**
144 |
145 | > `Field` 类型是否包含 `transient`。
146 |
147 | ## isNative - i-ext-field
148 |
149 | ```kotlin:no-line-numbers
150 | val isNative: Boolean
151 | ```
152 |
153 | **变更记录**
154 |
155 | `v1.0.0` `添加`
156 |
157 | **功能描述**
158 |
159 | > `Method` 类型是否包含 `native`。
160 |
161 | 对于任意 JNI 对接的 `Method` 可添加此描述进行确定。
162 |
163 | ## isInterface - i-ext-field
164 |
165 | ```kotlin:no-line-numbers
166 | val isInterface: Boolean
167 | ```
168 |
169 | **变更记录**
170 |
171 | `v1.0.0` `添加`
172 |
173 | **功能描述**
174 |
175 | > `Class` 类型是否包含 `interface`。
176 |
177 | ## isAbstract - i-ext-field
178 |
179 | ```kotlin:no-line-numbers
180 | val isAbstract: Boolean
181 | ```
182 |
183 | **变更记录**
184 |
185 | `v1.0.0` `添加`
186 |
187 | **功能描述**
188 |
189 | > `Class`、`Member` 类型是否包含 `abstract`。
190 |
191 | 对于任意的抽象 `Class`、`Member` 可添加此描述进行确定。
192 |
193 | ## isStrict - i-ext-field
194 |
195 | ```kotlin:no-line-numbers
196 | val isStrict: Boolean
197 | ```
198 |
199 | **变更记录**
200 |
201 | `v1.0.0` `添加`
202 |
203 | **功能描述**
204 |
205 | > `Class`、`Member` 类型是否包含 `strictfp`。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/base/rules/NameRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # NameRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class NameRules private constructor()
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是一个模糊 `Class`、`Member` 名称条件实现类。
18 |
19 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
20 |
21 | ## String.isSynthetic - i-ext-method
22 |
23 | ```kotlin:no-line-numbers
24 | fun String.isSynthetic(index: Int): Boolean
25 | ```
26 |
27 | **变更记录**
28 |
29 | `v1.0.0` `添加`
30 |
31 | **功能描述**
32 |
33 | > 是否为匿名类的主类调用对象。
34 |
35 | ## String.isOnlySymbols - i-ext-method
36 |
37 | ```kotlin:no-line-numbers
38 | fun String.isOnlySymbols(): Boolean
39 | ```
40 |
41 | **变更记录**
42 |
43 | `v1.0.0` `添加`
44 |
45 | **功能描述**
46 |
47 | > 是否只有符号。
48 |
49 | ## String.isOnlyLetters - i-ext-method
50 |
51 | ```kotlin:no-line-numbers
52 | fun String.isOnlyLetters(): Boolean
53 | ```
54 |
55 | **变更记录**
56 |
57 | `v1.0.0` `添加`
58 |
59 | **功能描述**
60 |
61 | > 是否只有字母。
62 |
63 | ## String.isOnlyNumbers - i-ext-method
64 |
65 | ```kotlin:no-line-numbers
66 | fun String.isOnlyNumbers(): Boolean
67 | ```
68 |
69 | **变更记录**
70 |
71 | `v1.0.0` `添加`
72 |
73 | **功能描述**
74 |
75 | > 是否只有数字。
76 |
77 | ## String.isOnlyLettersNumbers - i-ext-method
78 |
79 | ```kotlin:no-line-numbers
80 | fun String.isOnlyLettersNumbers(): Boolean
81 | ```
82 |
83 | **变更记录**
84 |
85 | `v1.0.0` `添加`
86 |
87 | **功能描述**
88 |
89 | > 是否只有字母或数字。
90 |
91 | ## String.isOnlyLowercase - i-ext-method
92 |
93 | ```kotlin:no-line-numbers
94 | fun String.isOnlyLowercase(): Boolean
95 | ```
96 |
97 | **变更记录**
98 |
99 | `v1.0.0` `添加`
100 |
101 | **功能描述**
102 |
103 | > 是否只有小写字母。
104 |
105 | 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
106 |
107 | ## String.isOnlyUppercase - i-ext-method
108 |
109 | ```kotlin:no-line-numbers
110 | fun String.isOnlyUppercase(): Boolean
111 | ```
112 |
113 | **变更记录**
114 |
115 | `v1.0.0` `添加`
116 |
117 | **功能描述**
118 |
119 | > 是否只有大写字母。
120 |
121 | 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/base/rules/ObjectRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # ObjectRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class ObjectRules private constructor(private val instance: Any)
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 这是一个任意对象条件实现类。
18 |
19 | 可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/classes/rules/ConstructorRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # ConstructorRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class ConstructorRules internal constructor(private val rulesData: ConstructorRulesData) : BaseRules
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > `Constructor` 查找条件实现类。
18 |
19 | ## paramCount - field
20 |
21 | ```kotlin:no-line-numbers
22 | var paramCount: Int
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 设置 `Constructor` 参数个数。
32 |
33 | 你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
34 |
35 | 若参数个数小于零则忽略并使用 `param`。
36 |
37 | ## modifiers - method
38 |
39 | ```kotlin:no-line-numbers
40 | fun modifiers(conditions: ModifierConditions)
41 | ```
42 |
43 | **变更记录**
44 |
45 | `v1.0.0` `添加`
46 |
47 | **功能描述**
48 |
49 | > 设置 `Constructor` 标识符筛选条件。
50 |
51 | 可不设置筛选条件。
52 |
53 | ## emptyParam - method
54 |
55 | ```kotlin:no-line-numbers
56 | fun emptyParam()
57 | ```
58 |
59 | **变更记录**
60 |
61 | `v1.0.0` `添加`
62 |
63 | **功能描述**
64 |
65 | > 设置 `Constructor` 空参数、无参数。
66 |
67 | ## param - method
68 |
69 | ```kotlin:no-line-numbers
70 | fun param(vararg paramType: Any)
71 | ```
72 |
73 | **变更记录**
74 |
75 | `v1.0.0` `添加`
76 |
77 | **功能描述**
78 |
79 | > 设置 `Constructor` 参数。
80 |
81 | 如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
82 |
83 | 如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
84 |
85 | ::: danger
86 |
87 | 无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
88 |
89 | 有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
90 |
91 | :::
92 |
93 | ## param - method
94 |
95 | ```kotlin:no-line-numbers
96 | fun param(conditions: ObjectsConditions)
97 | ```
98 |
99 | **变更记录**
100 |
101 | `v1.0.0` `添加`
102 |
103 | **功能描述**
104 |
105 | > 设置 `Constructor` 参数条件。
106 |
107 | ::: danger
108 |
109 | 无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
110 |
111 | 有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
112 |
113 | :::
114 |
115 | ## paramCount - method
116 |
117 | ```kotlin:no-line-numbers
118 | fun paramCount(numRange: IntRange)
119 | ```
120 |
121 | **变更记录**
122 |
123 | `v1.0.0` `添加`
124 |
125 | **功能描述**
126 |
127 | > 设置 `Constructor` 参数个数范围。
128 |
129 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
130 |
131 | ## paramCount - method
132 |
133 | ```kotlin:no-line-numbers
134 | fun paramCount(conditions: CountConditions)
135 | ```
136 |
137 | **变更记录**
138 |
139 | `v1.0.0` `添加`
140 |
141 | **功能描述**
142 |
143 | > 设置 `Constructor` 参数个数条件。
144 |
145 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/classes/rules/FieldRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # FieldRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class FieldRules internal constructor(private val rulesData: FieldRulesData) : BaseRules
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > `Field` 查找条件实现类。
18 |
19 | ## name - field
20 |
21 | ```kotlin:no-line-numbers
22 | var name: String
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 设置 `Field` 名称。
32 |
33 | ## type - field
34 |
35 | ```kotlin:no-line-numbers
36 | var type: Any?
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.0` `添加`
42 |
43 | **功能描述**
44 |
45 | > 设置 `Field` 类型。
46 |
47 | 可不填写类型。
48 |
49 | ## modifiers - method
50 |
51 | ```kotlin:no-line-numbers
52 | fun modifiers(conditions: ModifierConditions)
53 | ```
54 |
55 | **变更记录**
56 |
57 | `v1.0.0` `添加`
58 |
59 | **功能描述**
60 |
61 | > 设置 `Field` 标识符筛选条件。
62 |
63 | 可不设置筛选条件。
64 |
65 | ## name - method
66 |
67 | ```kotlin:no-line-numbers
68 | fun name(conditions: NameConditions)
69 | ```
70 |
71 | **变更记录**
72 |
73 | `v1.0.0` `添加`
74 |
75 | **功能描述**
76 |
77 | > 设置 `Field` 名称条件。
78 |
79 | ## type - method
80 |
81 | ```kotlin:no-line-numbers
82 | fun type(conditions: ObjectConditions)
83 | ```
84 |
85 | **变更记录**
86 |
87 | `v1.0.0` `添加`
88 |
89 | **功能描述**
90 |
91 | > 设置 `Field` 类型条件。
92 |
93 | 可不填写类型。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/classes/rules/MemberRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # MemberRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class MemberRules internal constructor(private val rulesData: MemberRulesData) : BaseRules
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > `Member` 查找条件实现类。
18 |
19 | ## modifiers - method
20 |
21 | ```kotlin:no-line-numbers
22 | fun modifiers(conditions: ModifierConditions)
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 设置 `Member` 标识符筛选条件。
32 |
33 | 可不设置筛选条件。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/classes/rules/MethodRules.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # MethodRules - class
6 |
7 | ```kotlin:no-line-numbers
8 | class MethodRules internal constructor(private val rulesData: MethodRulesData) : BaseRules
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > `Method` 查找条件实现类。
18 |
19 | ## name - field
20 |
21 | ```kotlin:no-line-numbers
22 | var name: String
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 设置 `Method` 名称。
32 |
33 | ## paramCount - field
34 |
35 | ```kotlin:no-line-numbers
36 | var paramCount: Int
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.0` `添加`
42 |
43 | **功能描述**
44 |
45 | > 设置 `Method` 参数个数。
46 |
47 | 你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
48 |
49 | 若参数个数小于零则忽略并使用 `param`。
50 |
51 | ## returnType - field
52 |
53 | ```kotlin:no-line-numbers
54 | var returnType: Any?
55 | ```
56 |
57 | **变更记录**
58 |
59 | `v1.0.0` `添加`
60 |
61 | **功能描述**
62 |
63 | > 设置 `Method` 返回值。
64 |
65 | 可不填写返回值。
66 |
67 | ## modifiers - method
68 |
69 | ```kotlin:no-line-numbers
70 | fun modifiers(conditions: ModifierConditions)
71 | ```
72 |
73 | **变更记录**
74 |
75 | `v1.0.0` `添加`
76 |
77 | **功能描述**
78 |
79 | > 设置 `Method` 标识符筛选条件。
80 |
81 | 可不设置筛选条件。
82 |
83 | ## emptyParam - method
84 |
85 | ```kotlin:no-line-numbers
86 | fun emptyParam()
87 | ```
88 |
89 | **变更记录**
90 |
91 | `v1.0.0` `添加`
92 |
93 | **功能描述**
94 |
95 | > 设置 `Method` 空参数、无参数。
96 |
97 | ## param - method
98 |
99 | ```kotlin:no-line-numbers
100 | fun param(vararg paramType: Any)
101 | ```
102 |
103 | **变更记录**
104 |
105 | `v1.0.0` `添加`
106 |
107 | **功能描述**
108 |
109 | > 设置 `Method` 参数。
110 |
111 | 如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
112 |
113 | 如果 `Method` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
114 |
115 | ::: danger
116 |
117 | 无参 **Method** 请使用 **emptyParam** 设置查找条件。
118 |
119 | 有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
120 |
121 | :::
122 |
123 | ## param - method
124 |
125 | ```kotlin:no-line-numbers
126 | fun param(conditions: ObjectsConditions)
127 | ```
128 |
129 | **变更记录**
130 |
131 | `v1.0.0` `添加`
132 |
133 | **功能描述**
134 |
135 | > 设置 `Method` 参数条件。
136 |
137 | ::: danger
138 |
139 | 无参 **Method** 请使用 **emptyParam** 设置查找条件。
140 |
141 | 有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
142 |
143 | :::
144 |
145 | ## name - method
146 |
147 | ```kotlin:no-line-numbers
148 | fun name(conditions: NameConditions)
149 | ```
150 |
151 | **变更记录**
152 |
153 | `v1.0.0` `添加`
154 |
155 | **功能描述**
156 |
157 | > 设置 `Method` 名称条件。
158 |
159 | ## paramCount - method
160 |
161 | ```kotlin:no-line-numbers
162 | fun paramCount(numRange: IntRange)
163 | ```
164 |
165 | **变更记录**
166 |
167 | `v1.0.0` `添加`
168 |
169 | **功能描述**
170 |
171 | > 设置 `Method` 参数个数范围。
172 |
173 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
174 |
175 | ## paramCount - method
176 |
177 | ```kotlin:no-line-numbers
178 | fun paramCount(conditions: CountConditions)
179 | ```
180 |
181 | **变更记录**
182 |
183 | `v1.0.0` `添加`
184 |
185 | **功能描述**
186 |
187 | > 设置 `Method` 参数个数条件。
188 |
189 | 你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
190 |
191 | ## returnType - method
192 |
193 | ```kotlin:no-line-numbers
194 | fun returnType(conditions: ObjectConditions)
195 | ```
196 |
197 | **变更记录**
198 |
199 | `v1.0.0` `添加`
200 |
201 | **功能描述**
202 |
203 | > 设置 `Method` 返回值条件。
204 |
205 | 可不填写返回值。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/finder/classes/rules/result/MemberRulesResult.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # MemberRulesResult - class
6 |
7 | ```kotlin:no-line-numbers
8 | class MemberRulesResult internal constructor(private val rulesData: MemberRulesData)
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.0` `添加`
14 |
15 | **功能描述**
16 |
17 | > 当前 `Member` 查找条件结果实现类。
18 |
19 | ## none - method
20 |
21 | ```kotlin:no-line-numbers
22 | fun none(): MemberRulesResult
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.0` `添加`
28 |
29 | **功能描述**
30 |
31 | > 设置当前 `Member` 在查找条件中个数为 `0`。
32 |
33 | ## count - method
34 |
35 | ```kotlin:no-line-numbers
36 | fun count(num: Int): MemberRulesResult
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.0` `添加`
42 |
43 | **功能描述**
44 |
45 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数。
46 |
47 | ## count - method
48 |
49 | ```kotlin:no-line-numbers
50 | fun count(numRange: IntRange): MemberRulesResult
51 | ```
52 |
53 | **变更记录**
54 |
55 | `v1.0.0` `添加`
56 |
57 | **功能描述**
58 |
59 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数范围。
60 |
61 | ## count - method
62 |
63 | ```kotlin:no-line-numbers
64 | fun count(conditions: CountConditions): MemberRulesResult
65 | ```
66 |
67 | **变更记录**
68 |
69 | `v1.0.0` `添加`
70 |
71 | **功能描述**
72 |
73 | > 设置当前 `Member` 在查找条件中需要全部匹配的个数条件。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/log/YLog.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # YLog - object
6 |
7 | ```kotlin:no-line-numbers
8 | object YLog
9 | ```
10 |
11 | **变更记录**
12 |
13 | `v1.0.3` `新增`
14 |
15 | **功能描述**
16 |
17 | > 全局 Log 管理类。
18 |
19 | ## Configs - object
20 |
21 | ```kotlin:no-line-numbers
22 | object Configs
23 | ```
24 |
25 | **变更记录**
26 |
27 | `v1.0.3` `新增`
28 |
29 | **功能描述**
30 |
31 | > 配置 `YLog`。
32 |
33 | ### tag - field
34 |
35 | ```kotlin:no-line-numbers
36 | var tag: String
37 | ```
38 |
39 | **变更记录**
40 |
41 | `v1.0.3` `新增`
42 |
43 | **功能描述**
44 |
45 | > 这是一个调试日志的全局标识。
46 |
47 | 默认文案为 `YukiReflection`。
48 |
49 | 你可以修改为你自己的文案。
50 |
51 | ### isEnable - field
52 |
53 | ```kotlin:no-line-numbers
54 | var isEnable: Boolean
55 | ```
56 |
57 | **变更记录**
58 |
59 | `v1.0.3` `新增`
60 |
61 | **功能描述**
62 |
63 | > 是否启用调试日志的输出功能。
64 |
65 | 关闭后将会停用 `YukiReflection` 对全部日志的输出。
66 |
67 | 当 `isEnable` 关闭后 `YukiReflection.Configs.isDebug` 也将同时关闭。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/type/android/ComponentTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # ComponentTypeFactory - kt
6 |
7 | **变更记录**
8 |
9 | `v1.0.0` `添加`
10 |
11 | **功能描述**
12 |
13 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
14 |
15 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/ComponentTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/type/android/GraphicsTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # GraphicsTypeFactory - kt
6 |
7 | **变更记录**
8 |
9 | `v1.0.0` `添加`
10 |
11 | **功能描述**
12 |
13 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
14 |
15 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/GraphicsTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/type/android/ViewTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # ViewTypeFactory - kt
6 |
7 | **变更记录**
8 |
9 | `v1.0.0` `添加`
10 |
11 | **功能描述**
12 |
13 | > 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
14 |
15 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/android/ViewTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/type/defined/DefinedTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # DefinedTypeFactory - kt
6 |
7 | **变更记录**
8 |
9 | `v1.0.0` `添加`
10 |
11 | **功能描述**
12 |
13 | > 这是一个内部类型的定义常量类,主要用于反射 API 相关用法的延伸。
14 |
15 | ## VagueType - field
16 |
17 | ```kotlin:no-line-numbers
18 | val VagueType: Class<*>
19 | ```
20 |
21 | **变更记录**
22 |
23 | `v1.0.0` `添加`
24 |
25 | **功能描述**
26 |
27 | > 得到模糊类型。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/api/public/com/highcapable/yukireflection/type/java/VariableTypeFactory.md:
--------------------------------------------------------------------------------
1 | ---
2 | pageClass: code-page
3 | ---
4 |
5 | # VariableTypeFactory - kt
6 |
7 | **变更记录**
8 |
9 | `v1.0.0` `添加`
10 |
11 | **功能描述**
12 |
13 | > 这是一个预置反射类型的常量类,主要为 Java 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
14 |
15 | 详情可 [点击这里](https://github.com/HighCapable/YukiReflection/blob/master/yukireflection/src/main/java/com/highcapable/yukireflection/type/java/VariableTypeFactory.kt) 进行查看。
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/config/api-example.md:
--------------------------------------------------------------------------------
1 | # API 基本配置
2 |
3 | > 这里介绍了 `YukiReflection` 的基本配置方法。
4 |
5 | `YukiReflection` 无需一些复杂的配置即可直接开始使用,且不会与 Java 原生的反射 API 冲突。
6 |
7 | 你可以在使用之前对 `YukiReflection` 进行一些功能配置。
8 |
9 | ## 获取 API 标签 & 版本
10 |
11 | 你可以通过如下方式获取当前 `YukiReflection` 的标签和版本。
12 |
13 | > 示例如下
14 |
15 | ```kotlin
16 | // 获取标签
17 | val tag = YukiReflection.TAG
18 | // 获取版本
19 | val version = YukiReflection.VERSION
20 | ```
21 |
22 | 你可以通过获取版本进行一些不同版本差异的判断或用于显示在关于信息中。
23 |
24 | ::: tip
25 |
26 | 更多功能请参考 [YukiReflection](../api/public/com/highcapable/yukireflection/YukiReflection)。
27 |
28 | :::
29 |
30 | ## 配置 API 相关功能
31 |
32 | 你可以通过 `YukiReflection.configs { ... }` 方法或 `YukiReflection.Configs` 来配置相关功能。
33 |
34 | ### 自定义调试日志标签
35 |
36 | 你可以使用如下方式来自定义调试日志的标签。
37 |
38 | API 内部的日志将会使用此标签进行打印。
39 |
40 | > 示例如下
41 |
42 | ```kotlin
43 | // 通过 configs 方法
44 | YukiReflection.configs {
45 | debugLog {
46 | tag = "YourCustomTag"
47 | }
48 | }
49 | // 直接设置
50 | YLog.Configs.tag = "YourCustomTag"
51 | ```
52 |
53 | ### 启用或禁用 Debug 模式
54 |
55 | 你可以使用如下方式来启用或禁用 Debug 模式。
56 |
57 | Debug 模式默认是关闭的,启用后将会打印详细日志 (例如反射查找功能的耗时) 到控制台。
58 |
59 | > 示例如下
60 |
61 | ```kotlin
62 | // 通过 configs 方法
63 | YukiReflection.configs {
64 | isDebug = true
65 | }
66 | // 直接设置
67 | YukiReflection.Configs.isDebug = true
68 | ```
69 |
70 | ### 启用或禁用调试日志的输出功能
71 |
72 | 你可以使用如下方式来启用或禁用调试日志的输出功能。
73 |
74 | 此功能默认启用,关闭后将会停用 `YukiReflection` 对全部日志的输出。
75 |
76 | > 示例如下
77 |
78 | ```kotlin
79 | // 通过 configs 方法
80 | YukiReflection.configs {
81 | debugLog {
82 | isEnable = true
83 | }
84 | }
85 | // 直接设置
86 | YLog.Configs.isEnable = true
87 | ```
88 |
89 | ### 使用 configs 方法配置
90 |
91 | 为了一次性配置多个功能,你可以直接使用 `YukiReflection.configs { ... }` 方法进行配置。
92 |
93 | > 示例如下
94 |
95 | ```kotlin
96 | YukiReflection.configs {
97 | debugLog {
98 | tag = "YourCustomTag"
99 | isEnable = true
100 | }
101 | isDebug = true
102 | }
103 | ```
104 |
105 | ::: tip
106 |
107 | 更多功能请参考 [YukiReflection.configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-method) 方法、[YukiReflection.Configs](../api/public/com/highcapable/yukireflection/YukiReflection#configs-object)。
108 |
109 | :::
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/guide/home.md:
--------------------------------------------------------------------------------
1 | # 介绍
2 |
3 | > `YukiReflection` 是一个基于 Java 和 Android 平台的反射 API。
4 |
5 | ## 背景
6 |
7 | 这是一个使用 Kotlin 基于 Java 原生反射 API 重新打造的一套简洁、高效的反射 API。
8 |
9 | `YukiReflection` 同时也是 [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI) 正在使用的核心功能。
10 |
11 | 名称取自 [《ももくり》女主 栗原 雪(Yuki)](https://www.bilibili.com/bangumi/play/ss5016)。
12 |
13 | ## 用途
14 |
15 | `YukiReflection` 完全采用 Kotlin **lambda** 语法构建。
16 |
17 | 它能取代 [Java 原生的反射 API](https://pdai.tech/md/java/basic/java-basic-x-reflection.html),使用更加人性化的语言实现一套更加完善的反射方案。
18 |
19 | ## 语言要求
20 |
21 | 请使用 Kotlin,API 部分代码构成同样兼容 Java 但基础反射场景的实现**可能完全无法使用**。
22 |
23 | 文档全部的 Demo 示例代码都将使用 Kotlin 进行描述,如果你完全不会使用 Kotlin 那你将有可能无法使用 `YukiReflection`。
24 |
25 | ## 灵感来源
26 |
27 | `YukiReflection` 最初是集成在 [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI) 项目中的核心功能,现在进行了解耦合,使得这套反射 API 可以在任何 Java 和 Android 平台的项目中使用。
28 |
29 | 现在,我们只需要编写少量的代码,就能实现一个简单的反射调用。
30 |
31 | 借助 Kotlin 优雅的 **lambda** 写法以及 `YukiReflection`,可以让你的反射逻辑更加美观清晰。
32 |
33 | > 示例如下
34 |
35 | :::: code-group
36 | ::: code-group-item Yuki Reflection
37 |
38 | ```kotlin
39 | "android.os.SystemProperties".toClass()
40 | .method {
41 | name = "get"
42 | param(StringClass, StringClass)
43 | }.get().call("ro.system.build.fingerprint", "none")
44 | ```
45 |
46 | :::
47 | ::: code-group-item Java Reflection
48 |
49 | ```kotlin
50 | Class.forName("android.os.SystemProperties")
51 | .getDeclaredMethod("get", String::class.java, String::class.java)
52 | .apply { isAccessible = true }
53 | .invoke(null, "ro.system.build.fingerprint", "none")
54 | ```
55 |
56 | :::
57 | ::::
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/guide/quick-start.md:
--------------------------------------------------------------------------------
1 | # 快速开始
2 |
3 | > 集成 `YukiReflection` 到你的项目中。
4 |
5 | ## 环境要求
6 |
7 | - Windows 7 及以上/macOS 10.14 及以上/Linux 发行版 (Arch/Debian)
8 |
9 | - Android Studio 2021.1 及以上
10 |
11 | - IntelliJ IDEA 2021.1 及以上
12 |
13 | - Kotlin 1.7.0 及以上
14 |
15 | - Android Gradle Plugin 7.0 及以上
16 |
17 | - Gradle 7.0 及以上
18 |
19 | - Java 11 及以上
20 |
21 | - Java 17 及以上 (Since API `1.0.3`)
22 |
23 | ## 项目要求
24 |
25 | 项目需要使用 `Android Studio` 或 `IntelliJ IDEA` 创建且类型为 Java 或 Android 项目并已集成 Kotlin 环境依赖。
26 |
27 | ### 集成依赖
28 |
29 | 我们推荐使用 Kotlin DSL 作为 Gradle 构建脚本语言并推荐使用 [SweetDependency](https://github.com/HighCapable/SweetDependency) 来管理依赖。
30 |
31 | #### SweetDependency (推荐)
32 |
33 | 在你的项目 `SweetDependency` 配置文件中添加存储库和依赖。
34 |
35 | > 示例如下
36 |
37 | ```yaml
38 | repositories:
39 | # MavenCentral 有 2 小时缓存,若无法集成最新版本请添加
40 | sonatype-oss-releases:
41 |
42 | libraries:
43 | com.highcapable.yukireflection:
44 | api:
45 | version: +
46 | ...
47 | ```
48 |
49 | 添加完成后运行一次 Gradle Sync,所有依赖版本将自动装配。
50 |
51 | 接下来,在你的项目 `build.gradle.kts` 中部署依赖。
52 |
53 | > 示例如下
54 |
55 | ```kotlin
56 | dependencies {
57 | implementation(com.highcapable.yukireflection.api)
58 | // ...
59 | }
60 | ```
61 |
62 | #### 传统方式
63 |
64 | 在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加存储库。
65 |
66 | > Kotlin DSL
67 |
68 | ```kotlin
69 | repositories {
70 | google()
71 | mavenCentral()
72 | // MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
73 | maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") }
74 | }
75 | ```
76 |
77 | > Groovy DSL
78 |
79 | ```groovy
80 | repositories {
81 | google()
82 | mavenCentral()
83 | // MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
84 | maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
85 | }
86 | ```
87 |
88 | 在你的项目 `build.gradle.kts` 或 `build.gradle` 中添加依赖。
89 |
90 | > Kotlin DSL
91 |
92 | ```kotlin
93 | dependencies {
94 | implementation("com.highcapable.yukireflection:api:")
95 | // ...
96 | }
97 | ```
98 |
99 | > Groovy DSL
100 |
101 | ```groovy
102 | dependencies {
103 | implementation 'com.highcapable.yukireflection:api:'
104 | // ...
105 | }
106 | ```
107 |
108 | 请将 **<yuki-version>** 修改为 [这里](../about/changelog) 的最新版本。
109 |
110 | ::: danger
111 |
112 | 如果你的项目目前正在使用 [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI) 的 1.x.x 版本,请不要重复集成 **YukiReflection**,因为 **YukiHookAPI** 已经包含了其中的功能且存在针对相关功能的改动,重复集成会造成功能性冲突引发异常,此时你应该前往 **YukiHookAPI** 的 [文档](https://highcapable.github.io/YukiHookAPI/zh-cn/) 查看对应的使用教程。
113 |
114 | **YukiHookAPI** 将在 **2.0.0** 版本完全分离 **YukiReflection**,届时你可以同时与 **YukiHookAPI** 使用。
115 |
116 | :::
117 |
118 | #### 配置 Java 版本
119 |
120 | 在你的项目 `build.gradle.kts` 或 `build.gradle` 中修改 Kotlin 的 Java 版本为 17 及以上。
121 |
122 | > Kotlin DSL
123 |
124 | ```kt
125 | android {
126 | compileOptions {
127 | sourceCompatibility = JavaVersion.VERSION_17
128 | targetCompatibility = JavaVersion.VERSION_17
129 | }
130 | kotlinOptions {
131 | jvmTarget = "17"
132 | }
133 | }
134 | ```
135 |
136 | > Groovy DSL
137 |
138 | ```groovy
139 | android {
140 | compileOptions {
141 | sourceCompatibility JavaVersion.VERSION_17
142 | targetCompatibility JavaVersion.VERSION_17
143 | }
144 | kotlinOptions {
145 | jvmTarget = '17'
146 | }
147 | }
148 | ```
149 |
150 | ::: warning
151 |
152 | 自 API **1.0.3** 版本后 Kotlin 使用的 Java 版本默认为 17,不再支持 11 及以下版本。
153 |
154 | :::
--------------------------------------------------------------------------------
/docs-source/src/zh-cn/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | title: 首页
4 | heroImage: /images/logo.png
5 | actions:
6 | - text: 快速上手
7 | link: /zh-cn/guide/home
8 | type: primary
9 | - text: 更新日志
10 | link: /zh-cn/about/changelog
11 | type: secondary
12 | features:
13 | - title: 轻量优雅
14 | details: 拥有一套强大、优雅、人性化、完全使用 Kotlin lambda 打造的 API,可以帮你快速实现字节码的查找以及反射功能。
15 | - title: 可跨平台
16 | details: 不仅仅是 Android 平台,它与 Java API 高度兼容,可使用在任何 Kotlin on JVM 的项目上,有 Java 的地方就可以使用。
17 | - title: 快速上手
18 | details: 简单易用,不需要繁琐的配置,不需要十足的开发经验,搭建环境集成依赖即可立即开始使用。
19 | footer: Apache-2.0 License | Copyright (C) 2019 HighCapable
20 | ---
21 |
22 | ### 来吧!让反射也变得诗情画意
23 |
24 | ```java
25 | public class World {
26 |
27 | private void sayHello(String content) {
28 | System.out.println("Hello " + content + "!");
29 | }
30 | }
31 | ```
32 |
33 | ```kotlin
34 | val newWorld = World()
35 | classOf().method {
36 | name = "sayHello"
37 | param(StringClass)
38 | type = UnitType
39 | }.get(newWorld).call("YukiReflection")
40 | ```
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Compiler Configuration
2 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
3 | android.useAndroidX=true
4 | android.nonTransitiveRClass=true
5 | kotlin.code.style=official
6 | kotlin.incremental.useClasspathSnapshot=true
7 | # Project Configuration
8 | project.name=YukiReflection
9 | project.url=https://github.com/HighCapable/YukiReflection
10 | project.groupName=com.highcapable.yukireflection
11 | project.yukireflection-core.moduleName=api
12 | project.yukireflection-core.version="1.0.3"
13 | project.android.compileSdk=35
14 | project.android.minSdk=21
15 | project.android.targetSdk=35
16 | project.samples-demo-android.packageName=${project.groupName}.demo_app
17 | project.samples-demo-android.versionName=universal
18 | project.samples-demo-android.versionCode=1
19 | project.samples-demo-jvm.groupName=${project.groupName}.demo_jvm
20 | # Maven Publish Configuration
21 | SONATYPE_HOST=S01
22 | RELEASE_SIGNING_ENABLED=true
23 | # Maven POM Configuration
24 | POM_NAME=YukiReflection
25 | POM_DESCRIPTION=An efficient Reflection API for Java and Android built in Kotlin.
26 | POM_URL=https://github.com/HighCapable/YukiReflection
27 | POM_LICENSE_NAME=Apache License 2.0
28 | POM_LICENSE_URL=https://github.com/HighCapable/YukiReflection/blob/master/LICENSE
29 | POM_LICENSE_DIST=repo
30 | POM_SCM_URL=https://github.com/HighCapable/YukiReflection
31 | POM_SCM_CONNECTION=scm:git:git://github.com/HighCapable/YukiReflection.git
32 | POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com/HighCapable/YukiReflection.git
33 | POM_DEVELOPER_ID=0
34 | POM_DEVELOPER_NAME=fankes
35 | POM_DEVELOPER_EMAIL=qzmmcn@163.com
36 | POM_DEVELOPER_URL=https://github.com/fankes
--------------------------------------------------------------------------------
/gradle/sweet-dependency/sweet-dependency-config.yaml:
--------------------------------------------------------------------------------
1 | preferences:
2 | autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES
3 | repositories-mode: FAIL_ON_PROJECT_REPOS
4 |
5 | repositories:
6 | gradle-plugin-portal:
7 | scope: PLUGINS
8 | google:
9 | maven-central:
10 |
11 | plugins:
12 | org.jetbrains.kotlin.jvm:
13 | alias: kotlin-jvm
14 | version: 2.1.10
15 | org.jetbrains.kotlin.android:
16 | alias: kotlin-android
17 | version-ref: kotlin-jvm
18 | org.jetbrains.compose:
19 | alias: jetbrains-compose
20 | version: 1.7.3
21 | org.jetbrains.kotlin.plugin.compose:
22 | alias: compose-compiler
23 | version-ref: kotlin-jvm
24 | com.android.application:
25 | alias: android-application
26 | version: 8.9.0
27 | com.vanniktech.maven.publish:
28 | alias: maven-publish
29 | version: 0.31.0
30 |
31 | libraries:
32 | androidx.compose:
33 | compose-bom:
34 | version: 2025.03.00
35 | androidx.compose.foundation:
36 | foundation:
37 | version:
38 | androidx.compose.ui:
39 | ui:
40 | version:
41 | androidx.compose.material3:
42 | material3:
43 | version:
44 | androidx.activity:
45 | activity-compose:
46 | version: 1.10.1
47 | androidx.core:
48 | core-ktx:
49 | version: 1.15.0
50 | androidx.appcompat:
51 | appcompat:
52 | version: 1.7.0
53 | com.google.android.material:
54 | material:
55 | version: 1.12.0
56 | androidx.test.ext:
57 | junit:
58 | version: 1.2.1
59 | androidx.test.espresso:
60 | espresso-core:
61 | version: 3.6.1
62 | junit:
63 | junit:
64 | version: 4.13.2
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3 | distributionPath=wrapper/dists
4 | zipStorePath=wrapper/dists
5 | zipStoreBase=GRADLE_USER_HOME
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/img-src/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/img-src/icon.png
--------------------------------------------------------------------------------
/samples/demo-android/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | autowire(libs.plugins.android.application)
3 | autowire(libs.plugins.kotlin.android)
4 | autowire(libs.plugins.compose.compiler)
5 | }
6 |
7 | android {
8 | namespace = property.project.samples.demo.android.packageName
9 | compileSdk = property.project.android.compileSdk
10 |
11 | defaultConfig {
12 | applicationId = property.project.samples.demo.android.packageName
13 | minSdk = property.project.android.minSdk
14 | targetSdk = property.project.android.targetSdk
15 | versionName = property.project.samples.demo.android.versionName
16 | versionCode = property.project.samples.demo.android.versionCode
17 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 | buildTypes {
20 | release {
21 | isMinifyEnabled = false
22 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility = JavaVersion.VERSION_17
27 | targetCompatibility = JavaVersion.VERSION_17
28 | }
29 | kotlinOptions {
30 | jvmTarget = "17"
31 | freeCompilerArgs = listOf(
32 | "-Xno-param-assertions",
33 | "-Xno-call-assertions",
34 | "-Xno-receiver-assertions"
35 | )
36 | }
37 | composeOptions {
38 | kotlinCompilerExtensionVersion = "1.5.3"
39 | }
40 | buildFeatures {
41 | buildConfig = true
42 | compose = true
43 | }
44 | lint { checkReleaseBuilds = false }
45 | }
46 |
47 | dependencies {
48 | implementation(projects.yukireflectionCore)
49 | implementation(platform(androidx.compose.compose.bom))
50 | implementation(androidx.compose.foundation.foundation)
51 | implementation(androidx.compose.ui.ui)
52 | implementation(androidx.compose.material3.material3)
53 | implementation(androidx.activity.activity.compose)
54 | implementation(androidx.core.core.ktx)
55 | implementation(androidx.appcompat.appcompat)
56 | implementation(com.google.android.material.material)
57 | testImplementation(junit.junit)
58 | androidTestImplementation(androidx.test.ext.junit)
59 | androidTestImplementation(androidx.test.espresso.espresso.core)
60 | }
--------------------------------------------------------------------------------
/samples/demo-android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | -ignorewarnings
24 |
25 | -optimizationpasses 10
26 | -dontusemixedcaseclassnames
27 |
28 | -dontoptimize
29 | -verbose
30 | -overloadaggressively
31 | -allowaccessmodification
32 |
33 | -adaptclassstrings
34 | -adaptresourcefilenames
35 | -adaptresourcefilecontents
36 |
37 | -renamesourcefileattribute P
38 | -keepattributes SourceFile,LineNumberTable
39 |
40 | -keep class com.highcapable.yukireflection.demo_app.test.Main {*;}
--------------------------------------------------------------------------------
/samples/demo-android/src/androidTest/java/com/highcapable/yukireflection/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.highcapable.yukireflection
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.highcapable.yukireflection", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/samples/demo-android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/java/com/highcapable/yukireflection/demo_app/test/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/8/7.
21 | */
22 | package com.highcapable.yukireflection.demo_app.test;
23 |
24 | @SuppressWarnings("FieldMayBeFinal")
25 | public class Main {
26 |
27 | private static String staticContent = "I am static!";
28 |
29 | private final String content;
30 |
31 | public Main(String content) {
32 | this.content = content;
33 | }
34 |
35 | public String getContent() {
36 | return content;
37 | }
38 |
39 | public static String getStaticContent() {
40 | return staticContent;
41 | }
42 | }
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/samples/demo-android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF31A4FF
4 | #FF777777
5 | #FFF0F5FF
6 | #FF2D2726
7 | #FF000000
8 | #FFFFFFFF
9 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #31A4FF
4 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | YukiReflection
3 |
--------------------------------------------------------------------------------
/samples/demo-android/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/samples/demo-android/src/test/java/com/highcapable/yukireflection/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.highcapable.yukireflection
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/samples/demo-jvm/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | autowire(libs.plugins.kotlin.jvm)
3 | autowire(libs.plugins.jetbrains.compose)
4 | autowire(libs.plugins.compose.compiler)
5 | }
6 |
7 | group = property.project.samples.demo.jvm.groupName
8 |
9 | java {
10 | sourceCompatibility = JavaVersion.VERSION_17
11 | targetCompatibility = JavaVersion.VERSION_17
12 | }
13 |
14 | kotlin {
15 | jvmToolchain(17)
16 | }
17 |
18 | compose.desktop {
19 | application {
20 | mainClass = "$group.MainKt"
21 | }
22 | }
23 |
24 | dependencies {
25 | implementation(projects.yukireflectionCore)
26 | implementation(compose.desktop.currentOs)
27 | implementation(compose.material3)
28 | }
--------------------------------------------------------------------------------
/samples/demo-jvm/src/main/java/com/highcapable/yukireflection/demo_jvm/test/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/8/7.
21 | */
22 | package com.highcapable.yukireflection.demo_jvm.test;
23 |
24 | @SuppressWarnings("FieldMayBeFinal")
25 | public class Main {
26 |
27 | private static String staticContent = "I am static!";
28 |
29 | private final String content;
30 |
31 | public Main(String content) {
32 | this.content = content;
33 | }
34 |
35 | public String getContent() {
36 | return content;
37 | }
38 |
39 | public static String getStaticContent() {
40 | return staticContent;
41 | }
42 | }
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
2 | pluginManagement {
3 | repositories {
4 | gradlePluginPortal()
5 | google()
6 | mavenCentral()
7 | }
8 | }
9 | plugins {
10 | id("com.highcapable.sweetdependency") version "1.0.4"
11 | id("com.highcapable.sweetproperty") version "1.0.5"
12 | }
13 | sweetProperty {
14 | global {
15 | sourcesCode {
16 | includeKeys("^project\\..*\$".toRegex())
17 | isEnableRestrictedAccess = true
18 | }
19 | }
20 | rootProject { all { isEnable = false } }
21 | project(":samples:demo-android") { sourcesCode { isEnable = false } }
22 | project(":samples:demo-jvm") { sourcesCode { isEnable = false } }
23 | project(":yukireflection-core") { sourcesCode { className = rootProject.name } }
24 | }
25 | rootProject.name = "YukiReflection"
26 | include(":samples:demo-android", ":samples:demo-jvm")
27 | include(":yukireflection-core")
--------------------------------------------------------------------------------
/yukireflection-core/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | autowire(libs.plugins.kotlin.jvm)
3 | autowire(libs.plugins.maven.publish)
4 | }
5 |
6 | group = property.project.groupName
7 | version = property.project.yukireflection.core.version
8 |
9 | java {
10 | sourceCompatibility = JavaVersion.VERSION_17
11 | targetCompatibility = JavaVersion.VERSION_17
12 | }
13 |
14 | kotlin {
15 | jvmToolchain(17)
16 | compilerOptions {
17 | freeCompilerArgs = listOf(
18 | "-Xno-param-assertions",
19 | "-Xno-call-assertions",
20 | "-Xno-receiver-assertions"
21 | )
22 | }
23 | }
24 |
25 | dependencies {
26 | compileOnly(autowire("libs/android-34.jar"))
27 | }
28 |
29 | mavenPublishing {
30 | coordinates(
31 | groupId = group.toString(),
32 | artifactId = property.project.yukireflection.core.moduleName,
33 | version = version.toString()
34 | )
35 | }
--------------------------------------------------------------------------------
/yukireflection-core/libs/android-34.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HighCapable/YukiReflection/d4ccd19ecd6f9bc2376cb2ea4f6fca06b46a259c/yukireflection-core/libs/android-34.jar
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/YukiReflection.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2023/1/21.
21 | */
22 | @file:Suppress("unused", "MemberVisibilityCanBePrivate", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
23 |
24 | package com.highcapable.yukireflection
25 |
26 | import com.highcapable.yukireflection.YukiReflection.Configs
27 | import com.highcapable.yukireflection.generated.YukiReflectionProperties
28 | import com.highcapable.yukireflection.log.YLog
29 | import java.lang.reflect.Member
30 |
31 | /**
32 | * [YukiReflection] 的装载调用类
33 | *
34 | * 你可以使用 [Configs] 对 [YukiReflection] 进行配置
35 | */
36 | object YukiReflection {
37 |
38 | /** 标签名称 */
39 | const val TAG = YukiReflectionProperties.PROJECT_NAME
40 |
41 | /** 当前版本 */
42 | const val VERSION = YukiReflectionProperties.PROJECT_YUKIREFLECTION_CORE_VERSION
43 |
44 | /**
45 | * 版本名称
46 | *
47 | * - 此方法已弃用 - 在之后的版本中将直接被删除
48 | *
49 | * - 请现在迁移到 [VERSION]
50 | */
51 | @Deprecated(message = "不再区分版本名称和版本号", ReplaceWith("VERSION"))
52 | const val API_VERSION_NAME = VERSION
53 |
54 | /**
55 | * 版本号
56 | *
57 | * - 此方法已弃用 - 在之后的版本中将直接被删除
58 | *
59 | * - 请现在迁移到 [VERSION]
60 | */
61 | @Deprecated(message = "不再区分版本名称和版本号", ReplaceWith("VERSION"))
62 | const val API_VERSION_CODE = -1
63 |
64 | /**
65 | * 配置 [YukiReflection]
66 | */
67 | object Configs {
68 |
69 | /**
70 | * 配置 [YLog.Configs] 相关参数
71 | * @param initiate 方法体
72 | */
73 | inline fun debugLog(initiate: YLog.Configs.() -> Unit) = YLog.Configs.apply(initiate).build()
74 |
75 | /**
76 | * 这是一个调试日志的全局标识
77 | *
78 | * - 此方法已弃用 - 在之后的版本中将直接被删除
79 | *
80 | * - 请现在迁移到 [debugLog] 并使用 [YLog.Configs.tag]
81 | */
82 | @Deprecated(message = "请使用新方式来实现此功能")
83 | var debugTag get() = YLog.Configs.tag
84 | set(value) {
85 | YLog.Configs.tag = value
86 | }
87 |
88 | /**
89 | * 是否开启调试模式 - 默认不启用
90 | *
91 | * 启用后将交由日志输出管理器打印详细日志 (例如反射查找功能的耗时) 到控制台
92 | *
93 | * 当 [YLog.Configs.isEnable] 关闭后 [isDebug] 也将同时关闭
94 | */
95 | var isDebug = false
96 |
97 | /**
98 | * 是否启用调试日志的输出功能
99 | *
100 | * - 此方法已弃用 - 在之后的版本中将直接被删除
101 | *
102 | * - 请现在迁移到 [debugLog] 并使用 [YLog.Configs.isEnable]
103 | */
104 | @Deprecated(message = "请使用新方式来实现此功能")
105 | var isAllowPrintingLogs get() = YLog.Configs.isEnable
106 | set(value) {
107 | YLog.Configs.isEnable = value
108 | }
109 |
110 | /**
111 | * 是否启用 [Member] 缓存功能
112 | *
113 | * - 此方法及功能已被移除 - 在之后的版本中将直接被删除
114 | *
115 | * - [Member] 的直接缓存功能已被移除 - 因为其存在内存溢出 (OOM) 问题
116 | */
117 | @Deprecated(message = "此方法及功能已被移除,请删除此方法")
118 | var isEnableMemberCache = false
119 |
120 | /** 结束方法体 */
121 | internal fun build() = Unit
122 | }
123 |
124 | /**
125 | * 配置 [YukiReflection] 相关参数
126 | * @param initiate 方法体
127 | */
128 | inline fun configs(initiate: Configs.() -> Unit) = Configs.apply(initiate).build()
129 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/bean/GenericClass.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/20.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | @file:Suppress("unused", "UNCHECKED_CAST", "NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
24 |
25 | package com.highcapable.yukireflection.bean
26 |
27 | import java.lang.reflect.ParameterizedType
28 |
29 | /**
30 | * 当前 [Class] 的泛型父类操作对象
31 | * @param type 类型声明实例
32 | */
33 | class GenericClass internal constructor(private val type: ParameterizedType) {
34 |
35 | /**
36 | * 获得泛型参数数组下标的 [Class] 实例
37 | *
38 | * - 在运行时局部变量的泛型会被擦除 - 获取不到时将会返回 null
39 | * @param index 数组下标 - 默认 0
40 | * @return [Class] or null
41 | */
42 | fun argument(index: Int = 0) = type.actualTypeArguments[index] as? Class<*>?
43 |
44 | /**
45 | * 获得泛型参数数组下标的 [Class] 实例
46 | *
47 | * - 在运行时局部变量的泛型会被擦除 - 获取不到时将会返回 null
48 | * @param index 数组下标 - 默认 0
49 | * @return [Class]<[T]> or null
50 | * @throws IllegalStateException 如果 [Class] 的类型不为 [T]
51 | */
52 | @JvmName("argument_Generics")
53 | inline fun argument(index: Int = 0) =
54 | type.actualTypeArguments[index].let { args ->
55 | if (args is Class<*>) args as? Class? ?: error("Target Class type cannot cast to ${T::class.java}")
56 | else null
57 | }
58 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/bean/VariousClass.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/2/10.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | @file:Suppress("unused")
24 |
25 | package com.highcapable.yukireflection.bean
26 |
27 | import com.highcapable.yukireflection.factory.toClassOrNull
28 |
29 | /**
30 | * 这是一个不确定性 [Class] 类名装载器
31 | * @param name 可指定多个类名 - 将会自动匹配存在的第一个类名
32 | */
33 | class VariousClass(private vararg val name: String) {
34 |
35 | /**
36 | * 获取匹配的实体类
37 | *
38 | * - 使用当前 [loader] 装载目标 [Class]
39 | * @param loader 当前 [ClassLoader] - 若留空使用默认 [ClassLoader]
40 | * @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
41 | * @return [Class]
42 | * @throws IllegalStateException 如果任何 [Class] 都没有匹配到
43 | */
44 | fun get(loader: ClassLoader? = null, initialize: Boolean = false): Class<*> {
45 | var finalClass: Class<*>? = null
46 | if (name.isNotEmpty()) run {
47 | name.forEach {
48 | finalClass = it.toClassOrNull(loader, initialize)
49 | if (finalClass != null) return@run
50 | }
51 | }
52 | return finalClass ?: error("VariousClass match failed of those $this")
53 | }
54 |
55 | /**
56 | * 获取匹配的实体类
57 | *
58 | * - 使用当前 [loader] 装载目标 [Class]
59 | *
60 | * 匹配不到 [Class] 会返回 null - 不会抛出异常
61 | * @param loader 当前 [ClassLoader] - 若留空使用默认 [ClassLoader]
62 | * @param initialize 是否初始化 [Class] 的静态方法块 - 默认否
63 | * @return [Class] or null
64 | */
65 | fun getOrNull(loader: ClassLoader? = null, initialize: Boolean = false) = runCatching { get(loader, initialize) }.getOrNull()
66 |
67 | override fun toString(): String {
68 | var result = ""
69 | return if (name.isNotEmpty()) {
70 | name.forEach { result += "\"$it\"," }
71 | "[${result.substring(0, result.lastIndex)}]"
72 | } else "[]"
73 | }
74 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/BaseFinder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.base
24 |
25 | import com.highcapable.yukireflection.bean.VariousClass
26 | import com.highcapable.yukireflection.factory.toClass
27 | import com.highcapable.yukireflection.finder.base.data.BaseRulesData
28 | import com.highcapable.yukireflection.type.defined.UndefinedType
29 | import java.lang.reflect.Member
30 | import kotlin.math.abs
31 |
32 | /**
33 | * 这是 [Class] 与 [Member] 查找类功能的基本类实现
34 | */
35 | abstract class BaseFinder {
36 |
37 | /** 当前查找条件规则数据 */
38 | internal abstract val rulesData: BaseRulesData
39 |
40 | /**
41 | * 字节码、数组下标筛选数据类型
42 | */
43 | internal enum class IndexConfigType { ORDER, MATCH }
44 |
45 | /**
46 | * 字节码、数组下标筛选实现类
47 | * @param type 类型
48 | */
49 | inner class IndexTypeCondition internal constructor(private val type: IndexConfigType) {
50 |
51 | /**
52 | * 设置下标
53 | *
54 | * 若 index 小于零则为倒序 - 此时可以使用 [IndexTypeConditionSort.reverse] 方法实现
55 | *
56 | * 可使用 [IndexTypeConditionSort.first] 和 [IndexTypeConditionSort.last] 设置首位和末位筛选条件
57 | * @param num 下标
58 | */
59 | fun index(num: Int) = when (type) {
60 | IndexConfigType.ORDER -> rulesData.orderIndex = Pair(num, true)
61 | IndexConfigType.MATCH -> rulesData.matchIndex = Pair(num, true)
62 | }
63 |
64 | /**
65 | * 得到下标
66 | * @return [IndexTypeConditionSort]
67 | */
68 | fun index() = IndexTypeConditionSort()
69 |
70 | /**
71 | * 字节码、数组下标排序实现类
72 | *
73 | * - 请使用 [index] 方法来获取 [IndexTypeConditionSort]
74 | */
75 | inner class IndexTypeConditionSort internal constructor() {
76 |
77 | /** 设置满足条件的第一个*/
78 | fun first() = index(num = 0)
79 |
80 | /** 设置满足条件的最后一个*/
81 | fun last() = when (type) {
82 | IndexConfigType.ORDER -> rulesData.orderIndex = Pair(0, false)
83 | IndexConfigType.MATCH -> rulesData.matchIndex = Pair(0, false)
84 | }
85 |
86 | /**
87 | * 设置倒序下标
88 | * @param num 下标
89 | */
90 | fun reverse(num: Int) = when {
91 | num < 0 -> index(abs(num))
92 | num == 0 -> index().last()
93 | else -> index(-num)
94 | }
95 | }
96 | }
97 |
98 | /**
99 | * 将目标类型转换为可识别的兼容类型
100 | * @param tag 当前查找类的标识
101 | * @param loader 使用的 [ClassLoader]
102 | * @return [Class] or null
103 | */
104 | internal fun Any?.compat(tag: String, loader: ClassLoader?) = when (this) {
105 | null -> null
106 | is Class<*> -> this
107 | is String -> runCatching { toClass(loader) }.getOrNull() ?: UndefinedType
108 | is VariousClass -> runCatching { get(loader) }.getOrNull() ?: UndefinedType
109 | else -> error("$tag match type \"$javaClass\" not allowed")
110 | } as Class<*>?
111 |
112 | /**
113 | * 返回结果实现类
114 | *
115 | * - 此功能交由方法体自动完成 - 你不应该手动调用此方法
116 | * @return [BaseResult]
117 | */
118 | internal abstract fun build(): BaseResult
119 |
120 | /**
121 | * 返回只有异常的结果实现类
122 | *
123 | * - 此功能交由方法体自动完成 - 你不应该手动调用此方法
124 | * @param throwable 异常
125 | * @return [BaseResult]
126 | */
127 | internal abstract fun failure(throwable: Throwable?): BaseResult
128 |
129 | /**
130 | * 查找结果实现、处理类接口
131 | *
132 | * - 此功能交由方法体自动完成 - 你不应该手动继承此接口
133 | */
134 | interface BaseResult
135 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/ClassBaseFinder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/25.
22 | */
23 | package com.highcapable.yukireflection.finder.base
24 |
25 | import com.highcapable.yukireflection.YukiReflection
26 | import com.highcapable.yukireflection.log.YLog
27 |
28 | /**
29 | * 这是 [Class] 查找类功能的基本类实现
30 | * @param loaderSet 当前使用的 [ClassLoader] 实例
31 | */
32 | abstract class ClassBaseFinder internal constructor(internal open val loaderSet: ClassLoader? = null) : BaseFinder() {
33 |
34 | internal companion object {
35 |
36 | /** [loaderSet] 为 null 的提示 */
37 | internal const val LOADERSET_IS_NULL = "loaderSet is null"
38 | }
39 |
40 | /** 当前找到的 [Class] 数组 */
41 | internal var classInstances = mutableListOf>()
42 |
43 | /** 是否开启忽略错误警告功能 */
44 | internal var isIgnoreErrorLogs = false
45 |
46 | /**
47 | * 将目标类型转换为可识别的兼容类型
48 | * @param any 当前需要转换的实例
49 | * @param tag 当前查找类的标识
50 | * @return [Class] or null
51 | */
52 | internal fun compatType(any: Any?, tag: String) = any?.compat(tag, loaderSet)
53 |
54 | /**
55 | * 在开启 [YukiReflection.Configs.isDebug] 的情况下输出调试信息
56 | * @param msg 消息内容
57 | */
58 | internal fun debugMsg(msg: String) {
59 | if (YukiReflection.Configs.isDebug) YLog.debug(msg)
60 | }
61 |
62 | /**
63 | * 发生错误时输出日志
64 | * @param e 异常堆栈 - 默认空
65 | */
66 | internal fun errorMsg(e: Throwable? = null) {
67 | if (isIgnoreErrorLogs) return
68 | /** 判断是否为 [LOADERSET_IS_NULL] */
69 | if (e?.message == LOADERSET_IS_NULL) return
70 | YLog.error(msg = "NoClassDefFound happend in [$loaderSet]", e = e)
71 | }
72 |
73 | override fun failure(throwable: Throwable?) = error("DexClassFinder does not contain this usage")
74 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/MemberBaseFinder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/2/18.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | @file:Suppress("MemberVisibilityCanBePrivate")
24 |
25 | package com.highcapable.yukireflection.finder.base
26 |
27 | import com.highcapable.yukireflection.YukiReflection
28 | import com.highcapable.yukireflection.log.YLog
29 | import com.highcapable.yukireflection.utils.factory.await
30 | import java.lang.reflect.Constructor
31 | import java.lang.reflect.Field
32 | import java.lang.reflect.Member
33 | import java.lang.reflect.Method
34 |
35 | /**
36 | * 这是 [Member] 查找类功能的基本类实现
37 | * @param tag 当前查找类的标识
38 | * @param classSet 当前需要查找的 [Class] 实例
39 | */
40 | abstract class MemberBaseFinder internal constructor(private val tag: String, internal open val classSet: Class<*>? = null) : BaseFinder() {
41 |
42 | internal companion object {
43 |
44 | /** [classSet] 为 null 的提示 */
45 | internal const val CLASSSET_IS_NULL = "classSet is null"
46 | }
47 |
48 | /** 是否使用了重查找功能 */
49 | internal var isUsingRemedyPlan = false
50 |
51 | /** 是否开启忽略错误警告功能 */
52 | internal var isIgnoreErrorLogs = false
53 |
54 | /** 当前找到的 [Member] 数组 */
55 | internal var memberInstances = mutableListOf()
56 |
57 | /**
58 | * 将 [MutableList]<[Member]> 转换为 [MutableList]<[Field]>
59 | * @return [MutableList]<[Field]>
60 | */
61 | internal fun MutableList.fields() =
62 | mutableListOf().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Field?)?.also { f -> it.add(f) } } }
63 |
64 | /**
65 | * 将 [MutableList]<[Member]> 转换为 [MutableList]<[Method]>
66 | * @return [MutableList]<[Method]>
67 | */
68 | internal fun MutableList.methods() =
69 | mutableListOf().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Method?)?.also { m -> it.add(m) } } }
70 |
71 | /**
72 | * 将 [MutableList]<[Member]> 转换为 [MutableList]<[Constructor]>
73 | * @return [MutableList]<[Constructor]>
74 | */
75 | internal fun MutableList.constructors() =
76 | mutableListOf>().also { takeIf { e -> e.isNotEmpty() }?.forEach { e -> (e as? Constructor<*>?)?.also { c -> it.add(c) } } }
77 |
78 | /**
79 | * 将目标类型转换为可识别的兼容类型
80 | * @return [Class] or null
81 | */
82 | internal fun Any?.compat() = compat(tag, classSet?.classLoader)
83 |
84 | /**
85 | * 在开启 [YukiReflection.Configs.isDebug] 的情况下输出调试信息
86 | * @param msg 消息内容
87 | */
88 | internal fun debugMsg(msg: String) {
89 | if (YukiReflection.Configs.isDebug) YLog.debug(msg)
90 | }
91 |
92 | /**
93 | * 发生错误时输出日志
94 | * @param msg 消息内容
95 | * @param e 异常堆栈 - 默认空
96 | * @param e 异常堆栈数组 - 默认空
97 | * @param isAlwaysMode 忽略条件每次都输出日志
98 | */
99 | internal fun errorMsg(msg: String = "", e: Throwable? = null, es: List = emptyList(), isAlwaysMode: Boolean = false) {
100 | /** 判断是否为 [CLASSSET_IS_NULL] */
101 | if (e?.message == CLASSSET_IS_NULL) return
102 | await {
103 | if (isIgnoreErrorLogs) return@await
104 | if (isAlwaysMode.not() && isUsingRemedyPlan) return@await
105 | YLog.error(msg = "NoSuch$tag happend in [$classSet] $msg".trim(), e = e)
106 | es.forEachIndexed { index, e -> YLog.error(msg = "Throwable [${index + 1}]", e = e) }
107 | }
108 | }
109 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/rules/CountRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/14.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | @file:Suppress("unused")
24 |
25 | package com.highcapable.yukireflection.finder.base.rules
26 |
27 | import java.lang.reflect.Member
28 |
29 | /**
30 | * 这是一个模糊 [Class]、[Member] 数组 (下标) 个数条件实现类
31 | *
32 | * 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
33 | * @param instance 当前实例对象
34 | */
35 | class CountRules private constructor(private val instance: Int) {
36 |
37 | internal companion object {
38 |
39 | /**
40 | * 创建实例
41 | * @param instance 实例对象
42 | * @return [CountRules]
43 | */
44 | internal fun with(instance: Int) = CountRules(instance)
45 | }
46 |
47 | /**
48 | * 是否为 0
49 | * @return [Boolean]
50 | */
51 | fun Int.isZero() = this == 0
52 |
53 | /**
54 | * 大于 [count]
55 | * @param count 目标对象
56 | * @return [Boolean]
57 | */
58 | fun Int.moreThan(count: Int) = this > count
59 |
60 | /**
61 | * 小于 [count]
62 | * @param count 目标对象
63 | * @return [Boolean]
64 | */
65 | fun Int.lessThan(count: Int) = this < count
66 |
67 | /**
68 | * 在 [countRange] 区间 A ≤ this ≤ B
69 | * @param countRange 区间
70 | * @return [Boolean]
71 | */
72 | fun Int.inInterval(countRange: IntRange) = this in countRange
73 |
74 | override fun toString() = "CountRules [$instance]"
75 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/rules/NameRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/5/16.
21 | * This file is modified by fankes on 2022/9/14.
22 | * This file is modified by fankes on 2023/1/21.
23 | */
24 | @file:Suppress("unused", "MemberVisibilityCanBePrivate")
25 |
26 | package com.highcapable.yukireflection.finder.base.rules
27 |
28 | import java.lang.reflect.Member
29 |
30 | /**
31 | * 这是一个模糊 [Class]、[Member] 名称条件实现类
32 | *
33 | * 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
34 | * @param instance 当前实例对象
35 | */
36 | class NameRules private constructor(private val instance: String) {
37 |
38 | internal companion object {
39 |
40 | /**
41 | * 创建实例
42 | * @param instance 实例对象
43 | * @return [NameRules]
44 | */
45 | internal fun with(instance: String) = NameRules(instance)
46 | }
47 |
48 | /**
49 | * 是否为匿名类的主类调用对象名称
50 | *
51 | * 它的名称形态通常为:this$[index]
52 | * @param index 下标 - 默认 0
53 | * @return [Boolean]
54 | */
55 | fun String.isSynthetic(index: Int = 0) = this == "this$$index"
56 |
57 | /**
58 | * 是否只有符号
59 | *
60 | * 筛选仅包含 _、-、?、!、,、.、<、> 等符号以及特殊符号
61 | *
62 | * 你可以使用 [matches] 方法进行更详细的正则匹配
63 | * @return [Boolean]
64 | */
65 | fun String.isOnlySymbols() = matches("[*,.:~`'\"|/\\\\?!^()\\[\\]{}%@#$&\\-_+=<>]+".toRegex())
66 |
67 | /**
68 | * 是否只有字母
69 | *
70 | * 在没有 [isOnlyLowercase] 以及 [isOnlyUppercase] 的条件下筛选仅包含 26 个大小写英文字母
71 | *
72 | * 你可以使用 [matches] 方法进行更详细的正则匹配
73 | * @return [Boolean]
74 | */
75 | fun String.isOnlyLetters() = matches("[a-zA-Z]+".toRegex())
76 |
77 | /**
78 | * 是否只有数字
79 | *
80 | * 筛选仅包含 0-9 阿拉伯数字
81 | *
82 | * 你可以使用 [matches] 方法进行更详细的正则匹配
83 | * @return [Boolean]
84 | */
85 | fun String.isOnlyNumbers() = matches("\\d+".toRegex())
86 |
87 | /**
88 | * 是否只有字母或数字
89 | *
90 | * 融合条件 [isOnlyLetters] 和 [isOnlyNumbers]
91 | *
92 | * 你可以使用 [matches] 方法进行更详细的正则匹配
93 | * @return [Boolean]
94 | */
95 | fun String.isOnlyLettersNumbers() = matches("[a-zA-Z\\d]+".toRegex())
96 |
97 | /**
98 | * 是否只有小写字母
99 | *
100 | * 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符
101 | *
102 | * 你可以使用 [matches] 方法进行更详细的正则匹配
103 | * @return [Boolean]
104 | */
105 | fun String.isOnlyLowercase() = matches("[a-z]+".toRegex())
106 |
107 | /**
108 | * 是否只有大写字母
109 | *
110 | * 在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符
111 | *
112 | * 你可以使用 [matches] 方法进行更详细的正则匹配
113 | * @return [Boolean]
114 | */
115 | fun String.isOnlyUppercase() = matches("[A-Z]+".toRegex())
116 |
117 | override fun toString() = "NameRules [$instance]"
118 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/base/rules/ObjectRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/12/30.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | @file:Suppress("unused")
24 |
25 | package com.highcapable.yukireflection.finder.base.rules
26 |
27 | import java.lang.reflect.Member
28 |
29 | /**
30 | * 这是一个任意对象条件实现类
31 | *
32 | * 可对 R8 混淆后的 [Class]、[Member] 进行更加详细的定位
33 | * @param instance 当前实例对象
34 | */
35 | class ObjectRules private constructor(private val instance: Any) {
36 |
37 | internal companion object {
38 |
39 | /**
40 | * 创建实例
41 | * @param instance 实例对象
42 | * @return [ObjectRules]
43 | */
44 | internal fun with(instance: Any) = ObjectRules(instance)
45 | }
46 |
47 | override fun toString() = "ObjectRules [$instance]"
48 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/classes/rules/FieldRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/12.
21 | * This file is modified by fankes on 2023/1/25.
22 | */
23 | package com.highcapable.yukireflection.finder.classes.rules
24 |
25 | import com.highcapable.yukireflection.bean.VariousClass
26 | import com.highcapable.yukireflection.finder.classes.rules.base.BaseRules
27 | import com.highcapable.yukireflection.finder.classes.rules.result.MemberRulesResult
28 | import com.highcapable.yukireflection.finder.members.data.FieldRulesData
29 | import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
30 | import com.highcapable.yukireflection.finder.type.factory.NameConditions
31 | import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
32 | import java.lang.reflect.Field
33 |
34 | /**
35 | * [Field] 查找条件实现类
36 | * @param rulesData 当前查找条件规则数据
37 | */
38 | class FieldRules internal constructor(private val rulesData: FieldRulesData) : BaseRules() {
39 |
40 | /**
41 | * 设置 [Field] 名称
42 | * @return [String]
43 | */
44 | var name
45 | get() = rulesData.name
46 | set(value) {
47 | rulesData.name = value
48 | }
49 |
50 | /**
51 | * 设置 [Field] 类型
52 | *
53 | * - 只能是 [Class]、[String]、[VariousClass]
54 | *
55 | * - 可不填写类型
56 | * @return [Any] or null
57 | */
58 | var type
59 | get() = rulesData.type
60 | set(value) {
61 | rulesData.type = value?.compat(tag = "Field")
62 | }
63 |
64 | /**
65 | * 设置 [Field] 标识符筛选条件
66 | *
67 | * - 可不设置筛选条件
68 | * @param conditions 条件方法体
69 | */
70 | fun modifiers(conditions: ModifierConditions) {
71 | rulesData.modifiers = conditions
72 | }
73 |
74 | /**
75 | * 设置 [Field] 名称条件
76 | * @param conditions 条件方法体
77 | */
78 | fun name(conditions: NameConditions) {
79 | rulesData.nameConditions = conditions
80 | }
81 |
82 | /**
83 | * 设置 [Field] 类型条件
84 | *
85 | * - 可不填写类型
86 | *
87 | * 使用示例如下 ↓
88 | *
89 | * ```kotlin
90 | * type { it == StringClass || it.name == "java.lang.String" }
91 | * ```
92 | * @param conditions 条件方法体
93 | */
94 | fun type(conditions: ObjectConditions) {
95 | rulesData.typeConditions = conditions
96 | }
97 |
98 | /**
99 | * 返回结果实现类
100 | * @return [MemberRulesResult]
101 | */
102 | internal fun build() = MemberRulesResult(rulesData)
103 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/classes/rules/MemberRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/12.
21 | * This file is modified by fankes on 2023/1/25.
22 | */
23 | package com.highcapable.yukireflection.finder.classes.rules
24 |
25 | import com.highcapable.yukireflection.finder.classes.rules.base.BaseRules
26 | import com.highcapable.yukireflection.finder.classes.rules.result.MemberRulesResult
27 | import com.highcapable.yukireflection.finder.members.data.MemberRulesData
28 | import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
29 | import java.lang.reflect.Member
30 |
31 | /**
32 | * [Member] 查找条件实现类
33 | * @param rulesData 当前查找条件规则数据
34 | */
35 | class MemberRules internal constructor(private val rulesData: MemberRulesData) : BaseRules() {
36 |
37 | /**
38 | * 设置 [Member] 标识符筛选条件
39 | *
40 | * - 可不设置筛选条件
41 | * @param conditions 条件方法体
42 | */
43 | fun modifiers(conditions: ModifierConditions) {
44 | rulesData.modifiers = conditions
45 | }
46 |
47 | /**
48 | * 返回结果实现类
49 | * @return [MemberRulesResult]
50 | */
51 | internal fun build() = MemberRulesResult(rulesData)
52 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/classes/rules/base/BaseRules.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/12.
21 | * This file is modified by fankes on 2023/1/25.
22 | */
23 | package com.highcapable.yukireflection.finder.classes.rules.base
24 |
25 | import com.highcapable.yukireflection.finder.classes.DexClassFinder
26 | import com.highcapable.yukireflection.finder.classes.rules.ConstructorRules
27 | import com.highcapable.yukireflection.finder.classes.rules.FieldRules
28 | import com.highcapable.yukireflection.finder.classes.rules.MemberRules
29 | import com.highcapable.yukireflection.finder.classes.rules.MethodRules
30 | import com.highcapable.yukireflection.finder.members.data.ConstructorRulesData
31 | import com.highcapable.yukireflection.finder.members.data.FieldRulesData
32 | import com.highcapable.yukireflection.finder.members.data.MemberRulesData
33 | import com.highcapable.yukireflection.finder.members.data.MethodRulesData
34 | import java.lang.reflect.Member
35 |
36 | /**
37 | * [Member] 查找条件实现父类
38 | * @param instance 当前查找类实例
39 | */
40 | open class BaseRules internal constructor(internal var instance: DexClassFinder? = null) {
41 |
42 | internal companion object {
43 |
44 | /**
45 | * 创建查找条件规则数据
46 | * @param instance 当前查找类实例
47 | * @return [MemberRulesData]
48 | */
49 | internal fun createMemberRules(instance: DexClassFinder) =
50 | MemberRules(MemberRulesData().apply { instance.rulesData.memberRules.add(this) }).apply { this.instance = instance }
51 |
52 | /**
53 | * 创建查找条件规则数据
54 | * @return [FieldRulesData]
55 | */
56 | internal fun createFieldRules(instance: DexClassFinder) =
57 | FieldRules(FieldRulesData().apply { instance.rulesData.fieldRules.add(this) }).apply { this.instance = instance }
58 |
59 | /**
60 | * 创建查找条件规则数据
61 | * @return [MethodRulesData]
62 | */
63 | internal fun createMethodRules(instance: DexClassFinder) =
64 | MethodRules(MethodRulesData().apply { instance.rulesData.methodRules.add(this) }).apply { this.instance = instance }
65 |
66 | /**
67 | * 创建查找条件规则数据
68 | * @return [ConstructorRulesData]
69 | */
70 | internal fun createConstructorRules(instance: DexClassFinder) =
71 | ConstructorRules(ConstructorRulesData().apply { instance.rulesData.constroctorRules.add(this) }).apply { this.instance = instance }
72 | }
73 |
74 | /**
75 | * 将目标类型转换为可识别的兼容类型
76 | * @param tag 当前查找类的标识
77 | * @return [Class] or null
78 | */
79 | internal fun Any?.compat(tag: String) = instance?.compatType(any = this, tag)
80 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/classes/rules/result/MemberRulesResult.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/12.
21 | * This file is modified by fankes on 2023/1/25.
22 | */
23 | @file:Suppress("unused", "MemberVisibilityCanBePrivate")
24 |
25 | package com.highcapable.yukireflection.finder.classes.rules.result
26 |
27 | import com.highcapable.yukireflection.finder.members.data.MemberRulesData
28 | import com.highcapable.yukireflection.finder.type.factory.CountConditions
29 | import java.lang.reflect.Member
30 |
31 | /**
32 | * 当前 [Member] 查找条件结果实现类
33 | * @param rulesData 当前查找条件规则数据
34 | */
35 | class MemberRulesResult internal constructor(private val rulesData: MemberRulesData) {
36 |
37 | /**
38 | * 设置当前 [Member] 在查找条件中个数为 0
39 | * @return [MemberRulesResult] 可继续向下监听
40 | */
41 | fun none() = count(num = 0)
42 |
43 | /**
44 | * 设置当前 [Member] 在查找条件中需要全部匹配的个数
45 | * @param num 个数
46 | * @return [MemberRulesResult] 可继续向下监听
47 | */
48 | fun count(num: Int): MemberRulesResult {
49 | rulesData.matchCount = num
50 | return this
51 | }
52 |
53 | /**
54 | * 设置当前 [Member] 在查找条件中需要全部匹配的个数范围
55 | *
56 | * 使用示例如下 ↓
57 | *
58 | * ```kotlin
59 | * count(1..5)
60 | * ```
61 | * @param numRange 个数范围
62 | * @return [MemberRulesResult] 可继续向下监听
63 | */
64 | fun count(numRange: IntRange): MemberRulesResult {
65 | rulesData.matchCountRange = numRange
66 | return this
67 | }
68 |
69 | /**
70 | * 设置当前 [Member] 在查找条件中需要全部匹配的个数条件
71 | *
72 | * 使用示例如下 ↓
73 | *
74 | * ```kotlin
75 | * count { it >= 5 || it.isZero() }
76 | * ```
77 | * @param conditions 条件方法体
78 | * @return [MemberRulesResult] 可继续向下监听
79 | */
80 | fun count(conditions: CountConditions): MemberRulesResult {
81 | rulesData.matchCountConditions = conditions
82 | return this
83 | }
84 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/members/data/ConstructorRulesData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.members.data
24 |
25 | import com.highcapable.yukireflection.finder.type.factory.CountConditions
26 | import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
27 | import java.lang.reflect.Constructor
28 |
29 | /**
30 | * [Constructor] 规则查找数据类
31 | * @param paramTypes 参数类型数组
32 | * @param paramTypesConditions 参数类型条件
33 | * @param paramCount 参数个数
34 | * @param paramCountRange 参数个数范围
35 | * @param paramCountConditions 参数个数条件
36 | */
37 | internal class ConstructorRulesData internal constructor(
38 | var paramTypes: Array>? = null,
39 | var paramTypesConditions: ObjectsConditions? = null,
40 | var paramCount: Int = -1,
41 | var paramCountRange: IntRange = IntRange.EMPTY,
42 | var paramCountConditions: CountConditions? = null
43 | ) : MemberRulesData() {
44 |
45 | override val templates
46 | get() = arrayOf(
47 | paramCount.takeIf { it >= 0 }?.let { "paramCount:[$it]" } ?: "",
48 | paramCountRange.takeIf { it.isEmpty().not() }?.let { "paramCountRange:[$it]" } ?: "",
49 | paramCountConditions?.let { "paramCountConditions:[existed]" } ?: "",
50 | paramTypes?.typeOfString()?.let { "paramTypes:[$it]" } ?: "",
51 | paramTypesConditions?.let { "paramTypesConditions:[existed]" } ?: "", *super.templates
52 | )
53 |
54 | override val objectName get() = "Constructor"
55 |
56 | override val isInitialize
57 | get() = super.isInitializeOfSuper || paramTypes != null || paramTypesConditions != null || paramCount >= 0 ||
58 | paramCountRange.isEmpty().not() || paramCountConditions != null
59 |
60 | override fun toString() = "[$paramTypes][$paramTypesConditions][$paramCount][$paramCountRange]" + super.toString()
61 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/members/data/FieldRulesData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.members.data
24 |
25 | import com.highcapable.yukireflection.finder.type.factory.NameConditions
26 | import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
27 | import java.lang.reflect.Field
28 |
29 | /**
30 | * [Field] 规则查找数据类
31 | * @param name 名称
32 | * @param nameConditions 名称规则
33 | * @param type 类型
34 | * @param typeConditions 类型条件
35 | */
36 | internal class FieldRulesData internal constructor(
37 | var name: String = "",
38 | var nameConditions: NameConditions? = null,
39 | var type: Any? = null,
40 | var typeConditions: ObjectConditions? = null
41 | ) : MemberRulesData() {
42 |
43 | override val templates
44 | get() = arrayOf(
45 | name.takeIf { it.isNotBlank() }?.let { "name:[$it]" } ?: "",
46 | nameConditions?.let { "nameConditions:[existed]" } ?: "",
47 | type?.let { "type:[$it]" } ?: "",
48 | typeConditions?.let { "typeConditions:[existed]" } ?: "", *super.templates
49 | )
50 |
51 | override val objectName get() = "Field"
52 |
53 | override val isInitialize
54 | get() = super.isInitializeOfSuper || name.isNotBlank() || nameConditions != null || type != null || typeConditions != null
55 |
56 | override fun toString() = "[$name][$nameConditions][$type][$typeConditions]" + super.toString()
57 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/members/data/MemberRulesData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.members.data
24 |
25 | import com.highcapable.yukireflection.finder.base.data.BaseRulesData
26 | import com.highcapable.yukireflection.finder.base.rules.ModifierRules
27 | import com.highcapable.yukireflection.finder.type.factory.CountConditions
28 | import java.lang.reflect.Member
29 |
30 | /**
31 | * [Member] 规则查找数据类
32 | * @param isFindInSuper 是否在未找到后继续在父类中查找
33 | * @param matchCount 匹配的字节码个数
34 | * @param matchCountRange 匹配的字节码个数范围
35 | * @param matchCountConditions 匹配的字节码个数条件
36 | */
37 | internal open class MemberRulesData internal constructor(
38 | var isFindInSuper: Boolean = false,
39 | var matchCount: Int = -1,
40 | var matchCountRange: IntRange = IntRange.EMPTY,
41 | var matchCountConditions: CountConditions? = null
42 | ) : BaseRulesData() {
43 |
44 | override val templates
45 | get() = arrayOf(
46 | modifiers?.let { "modifiers:${ModifierRules.templates(uniqueValue)}" } ?: "",
47 | orderIndex?.let { it.takeIf { it.second }?.let { e -> "orderIndex:[${e.first}]" } ?: "orderIndex:[last]" } ?: "",
48 | matchIndex?.let { it.takeIf { it.second }?.let { e -> "matchIndex:[${e.first}]" } ?: "matchIndex:[last]" } ?: ""
49 | )
50 |
51 | override val objectName get() = "Member"
52 |
53 | /**
54 | * 判断 [matchCount]、[matchCountRange] 规则是否已经初始化 (设置了任意一个参数)
55 | * @return [Boolean]
56 | */
57 | internal val isInitializeOfMatch get() = matchCount >= 0 || matchCountRange.isEmpty().not() || matchCountConditions != null
58 |
59 | /**
60 | * 判断 [BaseRulesData] 规则是否已经初始化 (设置了任意一个参数)
61 | * @return [Boolean]
62 | */
63 | internal val isInitializeOfSuper get() = super.isInitialize
64 |
65 | override val isInitialize get() = isInitializeOfSuper || isInitializeOfMatch
66 |
67 | override fun toString() = "[$isFindInSuper][$matchIndex][$matchCountRange][$matchCountConditions]" + super.toString()
68 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/members/data/MethodRulesData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/4.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.members.data
24 |
25 | import com.highcapable.yukireflection.finder.type.factory.CountConditions
26 | import com.highcapable.yukireflection.finder.type.factory.NameConditions
27 | import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
28 | import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
29 | import java.lang.reflect.Method
30 |
31 | /**
32 | * [Method] 规则查找数据类
33 | * @param name 名称
34 | * @param nameConditions 名称规则
35 | * @param paramTypes 参数类型数组
36 | * @param paramTypesConditions 参数类型条件
37 | * @param paramCount 参数个数
38 | * @param paramCountRange 参数个数范围
39 | * @param paramCountConditions 参数个数条件
40 | * @param returnType 返回值类型
41 | * @param returnTypeConditions 返回值类型条件
42 | */
43 | internal class MethodRulesData internal constructor(
44 | var name: String = "",
45 | var nameConditions: NameConditions? = null,
46 | var paramTypes: Array>? = null,
47 | var paramTypesConditions: ObjectsConditions? = null,
48 | var paramCount: Int = -1,
49 | var paramCountRange: IntRange = IntRange.EMPTY,
50 | var paramCountConditions: CountConditions? = null,
51 | var returnType: Any? = null,
52 | var returnTypeConditions: ObjectConditions? = null
53 | ) : MemberRulesData() {
54 |
55 | override val templates
56 | get() = arrayOf(
57 | name.takeIf { it.isNotBlank() }?.let { "name:[$it]" } ?: "",
58 | nameConditions?.let { "nameConditions:[existed]" } ?: "",
59 | paramCount.takeIf { it >= 0 }?.let { "paramCount:[$it]" } ?: "",
60 | paramCountRange.takeIf { it.isEmpty().not() }?.let { "paramCountRange:[$it]" } ?: "",
61 | paramCountConditions?.let { "paramCountConditions:[existed]" } ?: "",
62 | paramTypes?.typeOfString()?.let { "paramTypes:[$it]" } ?: "",
63 | paramTypesConditions?.let { "paramTypesConditions:[existed]" } ?: "",
64 | returnType?.let { "returnType:[$it]" } ?: "",
65 | returnTypeConditions?.let { "returnTypeConditions:[existed]" } ?: "", *super.templates
66 | )
67 |
68 | override val objectName get() = "Method"
69 |
70 | override val isInitialize
71 | get() = super.isInitializeOfSuper || name.isNotBlank() || nameConditions != null || paramTypes != null || paramTypesConditions != null ||
72 | paramCount >= 0 || paramCountRange.isEmpty().not() || paramCountConditions != null ||
73 | returnType != null || returnTypeConditions != null
74 |
75 | override fun toString() = "[$name][$nameConditions][$paramTypes][$paramTypesConditions][$paramCount]" +
76 | "[$paramCountRange][$returnType][$returnTypeConditions]" + super.toString()
77 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/finder/type/factory/TypeAliasFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/9/14.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.finder.type.factory
24 |
25 | import com.highcapable.yukireflection.finder.base.rules.CountRules
26 | import com.highcapable.yukireflection.finder.base.rules.ModifierRules
27 | import com.highcapable.yukireflection.finder.base.rules.NameRules
28 | import com.highcapable.yukireflection.finder.base.rules.ObjectRules
29 | import com.highcapable.yukireflection.finder.classes.DexClassFinder
30 | import com.highcapable.yukireflection.finder.members.ConstructorFinder
31 | import com.highcapable.yukireflection.finder.members.FieldFinder
32 | import com.highcapable.yukireflection.finder.members.MethodFinder
33 |
34 | /** 定义 [ClassLoader] 装载实例方法体类型 */
35 | internal typealias ClassLoaderInitializer = () -> ClassLoader?
36 |
37 | /** 定义 [DexClassFinder] 方法体类型 */
38 | internal typealias ClassConditions = DexClassFinder.() -> Unit
39 |
40 | /** 定义 [FieldFinder] 方法体类型 */
41 | internal typealias FieldConditions = FieldFinder.() -> Unit
42 |
43 | /** 定义 [MethodFinder] 方法体类型 */
44 | internal typealias MethodConditions = MethodFinder.() -> Unit
45 |
46 | /** 定义 [ConstructorFinder] 方法体类型 */
47 | internal typealias ConstructorConditions = ConstructorFinder.() -> Unit
48 |
49 | /** 定义 [NameRules] 方法体类型 */
50 | internal typealias NameConditions = NameRules.(String) -> Boolean
51 |
52 | /** 定义 [CountRules] 方法体类型 */
53 | internal typealias CountConditions = CountRules.(Int) -> Boolean
54 |
55 | /** 定义 [ModifierRules] 方法体类型 */
56 | internal typealias ModifierConditions = ModifierRules.() -> Boolean
57 |
58 | /** 定义 [ObjectRules] 方法体类型 */
59 | internal typealias ObjectConditions = ObjectRules.(Class<*>) -> Boolean
60 |
61 | /** 定义 [ObjectRules] 方法体类型 */
62 | internal typealias ObjectsConditions = ObjectRules.(Array>) -> Boolean
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/log/YLog.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2023/9/23.
21 | */
22 | @file:Suppress("unused")
23 |
24 | package com.highcapable.yukireflection.log
25 |
26 | import android.util.Log
27 | import com.highcapable.yukireflection.YukiReflection
28 | import com.highcapable.yukireflection.factory.hasClass
29 | import com.highcapable.yukireflection.utils.factory.dumpToString
30 |
31 | /**
32 | * 全局 Log 管理类
33 | */
34 | object YLog {
35 |
36 | /**
37 | * 配置 [YLog]
38 | */
39 | object Configs {
40 |
41 | /**
42 | * 这是一个调试日志的全局标识
43 | *
44 | * 默认文案为 [YukiReflection.TAG]
45 | *
46 | * 你可以修改为你自己的文案
47 | */
48 | var tag = YukiReflection.TAG
49 |
50 | /**
51 | * 是否启用调试日志的输出功能 - 默认启用
52 | *
53 | * - 关闭后将会停用 [YukiReflection] 对全部日志的输出
54 | *
55 | * 当 [isEnable] 关闭后 [YukiReflection.Configs.isDebug] 也将同时关闭
56 | */
57 | var isEnable = true
58 |
59 | /** 结束方法体 */
60 | internal fun build() = Unit
61 | }
62 |
63 | /**
64 | * 打印 Debug 级别 Log
65 | * @param msg 消息内容
66 | * @param e 异常堆栈 - 默认空
67 | */
68 | internal fun debug(msg: String, e: Throwable? = null) {
69 | if (Configs.isEnable) log(Type.DEBUG, msg, e)
70 | }
71 |
72 | /**
73 | * 打印 Info 级别 Log
74 | * @param msg 消息内容
75 | * @param e 异常堆栈 - 默认空
76 | */
77 | internal fun info(msg: String, e: Throwable? = null) {
78 | if (Configs.isEnable) log(Type.INFO, msg, e)
79 | }
80 |
81 | /**
82 | * 打印 Warn 级别 Log
83 | * @param msg 消息内容
84 | * @param e 异常堆栈 - 默认空
85 | */
86 | internal fun warn(msg: String, e: Throwable? = null) {
87 | if (Configs.isEnable) log(Type.WARN, msg, e)
88 | }
89 |
90 | /**
91 | * 打印 Error 级别 Log
92 | * @param msg 消息内容
93 | * @param e 异常堆栈 - 默认空
94 | */
95 | internal fun error(msg: String, e: Throwable? = null) {
96 | if (Configs.isEnable) log(Type.ERROR, msg, e)
97 | }
98 |
99 | /**
100 | * 打印 Log
101 | * @param type 类型
102 | * @param msg 消息内容
103 | * @param e 异常堆栈 - 默认空
104 | */
105 | private fun log(type: Type, msg: String, e: Throwable? = null) {
106 | val isAndroid = "android.util.Log".hasClass()
107 |
108 | /**
109 | * 打印 Log
110 | * @param msg 消息内容
111 | */
112 | fun innerLog(msg: String) {
113 | val mixedContent = "[${Configs.tag}][${type.alias}] $msg"
114 | when {
115 | isAndroid -> when (type) {
116 | Type.DEBUG -> Log.d(Configs.tag, msg, e)
117 | Type.INFO -> Log.i(Configs.tag, msg, e)
118 | Type.WARN -> Log.w(Configs.tag, msg, e)
119 | Type.ERROR -> Log.e(Configs.tag, msg, e)
120 | }
121 | type.color.isBlank() -> println(mixedContent)
122 | else -> println("\u001B[${type.color}m$mixedContent\u001B[0m")
123 | }
124 | }; innerLog(msg)
125 | if (isAndroid.not()) e?.also { innerLog(it.dumpToString()) }
126 | }
127 |
128 | /**
129 | * Log 类型定义类
130 | * @param alias 类型别名
131 | * @param color 颜色代码 - 默认无颜色
132 | */
133 | private enum class Type(val alias: String, val color: String = "") {
134 | DEBUG("D"), INFO("I", "38;5;10"), WARN("W", "33"), ERROR("E", "31")
135 | }
136 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/type/defined/DefinedTypeFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2022/4/3.
21 | * This file is modified by fankes on 2023/1/21.
22 | */
23 | package com.highcapable.yukireflection.type.defined
24 |
25 | import com.highcapable.yukireflection.factory.classOf
26 |
27 | /**
28 | * 未定义类型实例
29 | *
30 | * 请使用 [UndefinedType] 来调用它
31 | */
32 | internal class UndefinedClass private constructor()
33 |
34 | /**
35 | * 模糊类型实例
36 | *
37 | * 请使用 [VagueType] 来调用它
38 | */
39 | class VagueClass private constructor()
40 |
41 | /**
42 | * 得到未定义类型
43 | * @return [Class]<[UndefinedClass]>
44 | */
45 | internal val UndefinedType get() = classOf()
46 |
47 | /**
48 | * 得到模糊类型
49 | * @return [Class]<[VagueClass]>
50 | */
51 | val VagueType get() = classOf()
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/utils/factory/ThreadFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2023/9/23.
21 | */
22 | @file:Suppress("unused")
23 |
24 | package com.highcapable.yukireflection.utils.factory
25 |
26 | import java.util.concurrent.ExecutorService
27 | import java.util.concurrent.Executors
28 |
29 | /**
30 | * 创建当前线程池服务
31 | * @return [ExecutorService]
32 | */
33 | private val currentThreadPool get() = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())
34 |
35 | /**
36 | * 启动 [Thread] 延迟等待 [block] 的结果 [T]
37 | * @param delayMs 延迟毫秒 - 默认 1 ms
38 | * @param block 方法块
39 | * @return [T]
40 | */
41 | internal inline fun T.await(delayMs: Long = 1, crossinline block: (T) -> Unit): T {
42 | currentThreadPool.apply {
43 | execute {
44 | if (delayMs > 0) Thread.sleep(delayMs)
45 | block(this@await)
46 | shutdown()
47 | }
48 | }
49 | return this
50 | }
51 |
52 | /**
53 | * 计算方法执行耗时
54 | * @param block 方法块
55 | * @return [RunBlockResult]
56 | */
57 | internal inline fun runBlocking(block: () -> R): RunBlockResult {
58 | val start = System.currentTimeMillis()
59 | block()
60 | return RunBlockResult(afterMs = System.currentTimeMillis() - start)
61 | }
62 |
63 | /**
64 | * 构造耗时计算结果类
65 | * @param afterMs 耗时
66 | */
67 | internal class RunBlockResult(internal val afterMs: Long) {
68 |
69 | /**
70 | * 获取耗时计算结果
71 | * @param result 回调结果 - ([Long] 耗时)
72 | */
73 | internal inline fun result(result: (Long) -> Unit) = result(afterMs)
74 | }
--------------------------------------------------------------------------------
/yukireflection-core/src/main/java/com/highcapable/yukireflection/utils/factory/ThrowableFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * YukiReflection - An efficient Reflection API for Java and Android built in Kotlin.
3 | * Copyright (C) 2019 HighCapable
4 | * https://github.com/HighCapable/YukiReflection
5 | *
6 | * Apache License Version 2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * https://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is created by fankes on 2023/9/23.
21 | */
22 | @file:Suppress("unused")
23 |
24 | package com.highcapable.yukireflection.utils.factory
25 |
26 | import java.io.ByteArrayOutputStream
27 | import java.io.PrintStream
28 |
29 | /**
30 | * 写出异常堆栈到字符串
31 | * @return [String]
32 | */
33 | internal fun Throwable.dumpToString() = ByteArrayOutputStream().also { printStackTrace(PrintStream(it)) }.toString()
--------------------------------------------------------------------------------