Class RepeatableMetaAnnotatedElement<T extends AnnotationMapping<Annotation>>

java.lang.Object
org.miaixz.bus.core.lang.annotation.resolve.elements.RepeatableMetaAnnotatedElement<T>
Type Parameters:
T - AnnotationMapping类型
All Implemented Interfaces:
Iterable<T>, AnnotatedElement

public class RepeatableMetaAnnotatedElement<T extends AnnotationMapping<Annotation>> extends Object implements AnnotatedElement, Iterable<T>

支持可重复注解的增强AnnotatedElement, 功能与MetaAnnotatedElement类似,但是存在下述差异:

  • 限制以同一根注解延伸出的树结构上——而不是AnnotatedElement上——每种类型注解只能保留一个, 即当AnnotatedElement存在多个根注解有相同的元注解时,这些元注解会都会被扫描到;
  • 支持扫描AnnotatedElement可重复注解,即当当前实例指定的RepeatableAnnotationCollector 支持从AnnotatedElement上直接声明的注解中获得可重复注解时, 则将会自动将其展开直到不为容器注解为止。 eg: A上存在注解X,该注解是一个容器注解,内部可重复注解Y, 包含解析后,得到注解X与可重复注解Y, 同理,若存在XYX的嵌套关系,则解析后获得全部三者;
由于上述机制,当通过实例的getAnnotation(Class)getDeclaredAnnotation(Class) 方法获得指定类型注解时,若该类型注解存在多个,仅能尽可能获得最先被扫描到的那一个。
Since:
Java 17+
Author:
Kimi Liu
See Also: