Modify change some private class constructor to internal and optimize some code

This commit is contained in:
2022-11-27 04:39:38 +08:00
parent 3a5efa168f
commit 8deed6a12e
12 changed files with 40 additions and 26 deletions

View File

@@ -65,7 +65,10 @@ import java.lang.reflect.Method
* @param packageParam 需要传入 [PackageParam] 实现方法调用
* @param hookClass 要 Hook 的 [HookClass] 实例
*/
class YukiMemberHookCreator(@PublishedApi internal val packageParam: PackageParam, @PublishedApi internal val hookClass: HookClass) {
class YukiMemberHookCreator @PublishedApi internal constructor(
@PublishedApi internal val packageParam: PackageParam,
@PublishedApi internal val hookClass: HookClass
) {
/** 默认 Hook 回调优先级 */
val PRIORITY_DEFAULT = YukiHookPriority.PRIORITY_DEFAULT

View File

@@ -46,7 +46,10 @@ import com.highcapable.yukihookapi.hook.xposed.bridge.dummy.YukiResources
* @param packageParam 需要传入 [PackageParam] 实现方法调用
* @param hookResources 要 Hook 的 [HookResources] 实例
*/
class YukiResourcesHookCreator(@PublishedApi internal val packageParam: PackageParam, @PublishedApi internal val hookResources: HookResources) {
class YukiResourcesHookCreator @PublishedApi internal constructor(
@PublishedApi internal val packageParam: PackageParam,
@PublishedApi internal val hookResources: HookResources
) {
/** 设置要 Hook 的 Resources */
@PublishedApi

View File

@@ -48,10 +48,8 @@ import java.lang.reflect.Method
*/
abstract class MemberBaseFinder internal constructor(
private val tag: String,
@PublishedApi
internal open val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi
internal open val classSet: Class<*>? = null
@PublishedApi internal open val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi internal open val classSet: Class<*>? = null
) : BaseFinder() {
internal companion object {

View File

@@ -89,7 +89,7 @@ class NameRules private constructor(private val instance: String) {
* 你可以使用 [matches] 方法进行更详细的正则匹配
* @return [Boolean]
*/
fun String.isOnlyNumbers() = matches("[0-9]+".toRegex())
fun String.isOnlyNumbers() = matches("\\d+".toRegex())
/**
* 是否只有字母或数字
@@ -99,7 +99,7 @@ class NameRules private constructor(private val instance: String) {
* 你可以使用 [matches] 方法进行更详细的正则匹配
* @return [Boolean]
*/
fun String.isOnlyLettersNumbers() = matches("[a-zA-Z0-9]+".toRegex())
fun String.isOnlyLettersNumbers() = matches("[a-zA-Z\\d]+".toRegex())
/**
* 是否只有小写字母

View File

@@ -57,10 +57,8 @@ import java.lang.reflect.Member
* @param classSet 当前需要查找的 [Class] 实例
*/
class ConstructorFinder @PublishedApi internal constructor(
@PublishedApi
override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi
override val classSet: Class<*>? = null
@PublishedApi override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi override val classSet: Class<*>? = null
) : MemberBaseFinder(tag = "Constructor", hookInstance, classSet) {
@PublishedApi

View File

@@ -25,7 +25,7 @@
*
* This file is Created by fankes on 2022/2/4.
*/
@file:Suppress("unused", "UNCHECKED_CAST", "MemberVisibilityCanBePrivate")
@file:Suppress("unused", "UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "KotlinConstantConditions")
package com.highcapable.yukihookapi.hook.core.finder.members
@@ -56,10 +56,8 @@ import java.lang.reflect.Field
* @param classSet 当前需要查找的 [Class] 实例
*/
class FieldFinder @PublishedApi internal constructor(
@PublishedApi
override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi
override val classSet: Class<*>? = null
@PublishedApi override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi override val classSet: Class<*>? = null
) : MemberBaseFinder(tag = "Field", hookInstance, classSet) {
@PublishedApi

View File

@@ -59,10 +59,8 @@ import java.lang.reflect.Method
* @param classSet 当前需要查找的 [Class] 实例
*/
class MethodFinder @PublishedApi internal constructor(
@PublishedApi
override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi
override val classSet: Class<*>? = null
@PublishedApi override val hookInstance: YukiMemberHookCreator.MemberHookCreator? = null,
@PublishedApi override val classSet: Class<*>? = null
) : MemberBaseFinder(tag = "Method", hookInstance, classSet) {
@PublishedApi

View File

@@ -25,7 +25,7 @@
*
* This file is Created by fankes on 2022/4/29.
*/
@file:Suppress("DEPRECATION", "unused")
@file:Suppress("unused", "DEPRECATION", "DiscouragedApi")
package com.highcapable.yukihookapi.hook.xposed.bridge.dummy