public abstract static class RepeatableAnnotationCollector.AbstractCollector extends Object implements RepeatableAnnotationCollector
RepeatableAnnotationCollector
的基本实现RepeatableAnnotationCollector.AbstractCollector, RepeatableAnnotationCollector.Condition, RepeatableAnnotationCollector.Full, RepeatableAnnotationCollector.None, RepeatableAnnotationCollector.Standard
Constructor and Description |
---|
AbstractCollector() |
Modifier and Type | Method and Description |
---|---|
List<Annotation> |
getAllRepeatableAnnotations(Annotation annotation)
若一个注解是可重复注解的容器注解,则尝试通过其属性获得获得包含的注解对象。
|
List<Annotation> |
getFinalRepeatableAnnotations(Annotation annotation)
若一个注解是可重复注解的容器注解,则尝试通过其属性获得获得包含的注解对象。
|
<T extends Annotation> |
getRepeatableAnnotations(Annotation annotation,
Class<T> annotationType)
若一个注解是可重复注解的容器注解,则尝试通过其属性获得获得包含的指定类型注解对象
|
protected Annotation[] |
getRepeatableAnnotationsFormAttribute(Annotation annotation,
Method method)
调用
value 方法,获得嵌套的可重复注解 |
protected abstract List<Method> |
resolveRepeatableMethod(Annotation annotation)
解析获得注解中存放可重复注解的属性
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearSingletonCaches, condition, full, none, standard
public final List<Annotation> getFinalRepeatableAnnotations(Annotation annotation)
若一个注解是可重复注解的容器注解,则尝试通过其属性获得获得包含的注解对象。 若包含的注解对象也是可重复注解的容器注解,则继续解析直到获得所有非容器注解为止。
getFinalRepeatableAnnotations
in interface RepeatableAnnotationCollector
annotation
- 容器注解annotation
不为容器注解,则数组中仅有其本身一个对象public List<Annotation> getAllRepeatableAnnotations(Annotation annotation)
若一个注解是可重复注解的容器注解,则尝试通过其属性获得获得包含的注解对象。
若包含的注解对象也是可重复注解的容器注解,则继续解析直到获得所有非容器注解为止。
当accumulate
为true
时,返回结果为全量的注解。
eg:
若存在嵌套关系a -> b -> c
,则解析注解a,
将获得全部a、b、c注解。
如果注解不包含可重复注解,则返回其本身。
getAllRepeatableAnnotations
in interface RepeatableAnnotationCollector
annotation
- 容器注解annotation
不为容器注解,则数组中仅有其本身一个对象public <T extends Annotation> List<T> getRepeatableAnnotations(Annotation annotation, Class<T> annotationType)
getRepeatableAnnotations
in interface RepeatableAnnotationCollector
T
- 注解类型annotation
- 容器注解annotationType
- 注解类型protected Annotation[] getRepeatableAnnotationsFormAttribute(Annotation annotation, Method method)
value
方法,获得嵌套的可重复注解annotation
- 注解对象method
- 容纳可重复注解的方法ClassCastException
- 当method
调用结果无法正确转为Annotation[]
类型时抛出protected abstract List<Method> resolveRepeatableMethod(Annotation annotation)
annotation
- 注解Copyright © 2025. All rights reserved.