- java.lang.Object
-
- org.redkale.boot.ClassFilter<T>
-
- 类型参数:
T
- 泛型
public final class ClassFilter<T> extends Object
class过滤器, 符合条件的class会保留下来存入FilterEntry。详情见: https://redkale.org
- 作者:
- zhangjx
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
ClassFilter.FilterEntry<T>
存放符合条件的class与class指定的属性项static class
ClassFilter.Loader
class加载类
-
构造器概要
构造器 构造器 说明 ClassFilter(RedkaleClassLoader classLoader, Class superClass)
ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass)
ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass, Class[] excludeSuperClasses)
ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass, Class[] excludeSuperClasses, AnyValue conf)
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
accept(String className)
判断class是否有效boolean
accept(AnyValue property, Class clazz, boolean autoscan)
判断class是否有效boolean
accept(AnyValue property, String className)
判断class是否有效boolean
acceptPattern(String className)
判断class是否符合正则表达式ClassFilter<T>
and(ClassFilter<T> filter)
static ClassFilter
create(String includeRegexs, String excludeRegexs)
static ClassFilter
create(RedkaleClassLoader classLoader, Class[] excludeSuperClasses, String includeRegexs, String excludeRegexs, Set<String> includeValues, Set<String> excludeValues)
void
filter(AnyValue property, String clazzName, boolean autoscan)
过滤指定的classvoid
filter(AnyValue property, String clazzName, boolean autoScan, URI url)
过滤指定的classvoid
filter(AnyValue property, String clazzName, URI url)
自动扫描地过滤指定的classstatic String
formatPackageRegex(String regex)
将通配符转成标准的正则表达式
包含^、$、\字符的视为标准正则表达式, 其他视为通配符 一个*表示包的一个层级, 两个*表示包的多层级 例如: *.platf.** 转成 ^(\w+)\.platf\.(.*)$ .platf.Set<ClassFilter.FilterEntry<T>>
getAllFilterEntrys()
获取所有的class集合Class<? extends Annotation>
getAnnotationClass()
Pattern[]
getExcludePatterns()
Class[]
getExcludeSuperClasses()
Predicate<String>
getExpectPredicate()
Set<ClassFilter.FilterEntry<T>>
getFilterEntrys()
获取符合条件的class集合Set<ClassFilter.FilterEntry<T>>
getFilterExpectEntrys()
获取预留的class集合Pattern[]
getIncludePatterns()
Set<String>
getPrivilegeExcludes()
Set<String>
getPrivilegeIncludes()
Class
getSuperClass()
boolean
isRefused()
ClassFilter<T>
or(ClassFilter<T> filter)
void
setAnnotationClass(Class<? extends Annotation> annotationClass)
void
setExcludePatterns(String[] excludePatterns)
void
setExcludeSuperClasses(Class[] excludeSuperClasses)
void
setExpectPredicate(Predicate<String> predicate)
void
setIncludePatterns(String[] includePatterns)
void
setPrivilegeExcludes(Set<String> privilegeExcludes)
void
setPrivilegeIncludes(Set<String> privilegeIncludes)
void
setRefused(boolean refused)
void
setSuperClass(Class superClass)
static Pattern[]
toPattern(String[] regexs)
-
-
-
构造器详细资料
-
ClassFilter
public ClassFilter(RedkaleClassLoader classLoader, Class superClass)
-
ClassFilter
public ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass)
-
ClassFilter
public ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass, Class[] excludeSuperClasses)
-
ClassFilter
public ClassFilter(RedkaleClassLoader classLoader, Class<? extends Annotation> annotationClass, Class superClass, Class[] excludeSuperClasses, AnyValue conf)
-
-
方法详细资料
-
create
public static ClassFilter create(String includeRegexs, String excludeRegexs)
-
create
public static ClassFilter create(RedkaleClassLoader classLoader, Class[] excludeSuperClasses, String includeRegexs, String excludeRegexs, Set<String> includeValues, Set<String> excludeValues)
-
or
public ClassFilter<T> or(ClassFilter<T> filter)
-
and
public ClassFilter<T> and(ClassFilter<T> filter)
-
getFilterEntrys
public final Set<ClassFilter.FilterEntry<T>> getFilterEntrys()
获取符合条件的class集合- 返回:
- Set<FilterEntry<T>>
-
getFilterExpectEntrys
public final Set<ClassFilter.FilterEntry<T>> getFilterExpectEntrys()
获取预留的class集合- 返回:
- Set<FilterEntry<T>>
-
getAllFilterEntrys
public final Set<ClassFilter.FilterEntry<T>> getAllFilterEntrys()
获取所有的class集合- 返回:
- Set<FilterEntry<T>>
-
filter
public final void filter(AnyValue property, String clazzName, URI url)
自动扫描地过滤指定的class- 参数:
property
- AnyValueclazzName
- Stringurl
- URL
-
filter
public final void filter(AnyValue property, String clazzName, boolean autoscan)
过滤指定的class- 参数:
property
- application.xml中对应class节点下的property属性项clazzName
- class名称autoscan
- 为true表示自动扫描的, false表示显著调用filter, AutoLoad的注解将被忽略
-
filter
public final void filter(AnyValue property, String clazzName, boolean autoScan, URI url)
过滤指定的class- 参数:
property
- application.xml中对应class节点下的property属性项clazzName
- class名称autoScan
- 为true表示自动扫描的, false表示显著调用filter, AutoLoad的注解将被忽略url
- URL
-
accept
public boolean accept(String className)
判断class是否有效- 参数:
className
- String- 返回:
- boolean
-
accept
public boolean accept(AnyValue property, String className)
判断class是否有效- 参数:
property
- AnyValueclassName
- String- 返回:
- boolean
-
acceptPattern
public boolean acceptPattern(String className)
判断class是否符合正则表达式- 参数:
className
- Class- 返回:
- boolean
-
accept
public boolean accept(AnyValue property, Class clazz, boolean autoscan)
判断class是否有效- 参数:
property
- AnyValueclazz
- Classautoscan
- boolean- 返回:
- boolean
-
formatPackageRegex
public static String formatPackageRegex(String regex)
将通配符转成标准的正则表达式
包含^、$、\字符的视为标准正则表达式, 其他视为通配符 一个*表示包的一个层级, 两个*表示包的多层级 例如: *.platf.** 转成 ^(\w+)\.platf\.(.*)$ .platf. 转成 ^(.*)\.platf\.(.*)$- 参数:
regex
- 正则表达式- 返回:
- Pattern
-
setSuperClass
public void setSuperClass(Class superClass)
-
getSuperClass
public Class getSuperClass()
-
getExcludeSuperClasses
public Class[] getExcludeSuperClasses()
-
setExcludeSuperClasses
public void setExcludeSuperClasses(Class[] excludeSuperClasses)
-
setAnnotationClass
public void setAnnotationClass(Class<? extends Annotation> annotationClass)
-
getIncludePatterns
public Pattern[] getIncludePatterns()
-
setIncludePatterns
public void setIncludePatterns(String[] includePatterns)
-
getExcludePatterns
public Pattern[] getExcludePatterns()
-
setExcludePatterns
public void setExcludePatterns(String[] excludePatterns)
-
getAnnotationClass
public Class<? extends Annotation> getAnnotationClass()
-
isRefused
public boolean isRefused()
-
setRefused
public void setRefused(boolean refused)
-
-