Class MetaScanner
java.lang.Object
org.aoju.bus.core.scanner.annotation.MetaScanner
- All Implemented Interfaces:
AnnotationScanner
扫描注解类上存在的注解,支持处理枚举实例或枚举类型 需要注意,当待解析是枚举类时,有可能与
TypeScanner冲突- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescription构造一个元注解扫描器,默认在扫描当前注解上的元注解后,并继续递归扫描元注解MetaScanner(boolean includeSupperMetaAnnotation) 构造一个元注解扫描器 -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotations(AnnotatedElement annotatedEle) 获取注解元素上的全部注解。voidscan(BiConsumer<Integer, Annotation> consumer, AnnotatedElement annotatedEle, Predicate<Annotation> filter) 按广度优先扫描指定注解上的元注解,对扫描到的注解与层级索引进行操作booleansupport(AnnotatedElement annotatedEle) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aoju.bus.core.scanner.AnnotationScanner
getIfSupport, scanIfSupport
-
Constructor Details
-
MetaScanner
public MetaScanner(boolean includeSupperMetaAnnotation) 构造一个元注解扫描器- Parameters:
includeSupperMetaAnnotation- 获取当前注解的元注解后,是否继续递归扫描的元注解的元注解
-
MetaScanner
public MetaScanner()构造一个元注解扫描器,默认在扫描当前注解上的元注解后,并继续递归扫描元注解
-
-
Method Details
-
support
- Specified by:
supportin interfaceAnnotationScanner- Parameters:
annotatedEle-AnnotatedElement,可以是Class、Method、Field、Constructor、ReflectPermission- Returns:
- 是否支持扫描该注解元素
-
getAnnotations
获取注解元素上的全部注解。调用该方法前,需要确保调用support(AnnotatedElement)返回为true- Specified by:
getAnnotationsin interfaceAnnotationScanner- Parameters:
annotatedEle-AnnotatedElement,可以是Class、Method、Field、Constructor、ReflectPermission- Returns:
- 注解
-
scan
public void scan(BiConsumer<Integer, Annotation> consumer, AnnotatedElement annotatedEle, Predicate<Annotation> filter) 按广度优先扫描指定注解上的元注解,对扫描到的注解与层级索引进行操作- Specified by:
scanin interfaceAnnotationScanner- Parameters:
consumer- 当前层级索引与操作annotatedEle-AnnotatedElement,可以是Class、Method、Field、Constructor、ReflectPermissionfilter- 过滤器
-