/**
* Find the annotations of given <code>annotationType</code> on given element and stores them in given
* <code>accumulator</code>.
* @param accumulator Accumulator
* @param element Annotated element
* @param annotationType Annotation type to lookup
* @param repeatableContainerType Optional repeteable annotation type
*/
private static <A extends Annotation> void findAnnotations(List<A> accumulator, AnnotatedElement element,
Class<A> annotationType, Class<? extends Annotation> repeatableContainerType) {
// direct lookup
A[] as = element.getAnnotationsByType(annotationType);
if (as.length > 0) {
for (A a : as) {
accumulator.add(a);
}
}
// check meta-annotations
Annotation[] all = element.getAnnotations();
if (all.length > 0) {
for (Annotation annotation : all) {
if (!isInJavaLangAnnotationPackage(annotation) && !annotation.annotationType().equals(annotationType)
&& (repeatableContainerType == null
|| !annotation.annotationType().equals(repeatableContainerType))) {
findAnnotations(accumulator, annotation.annotationType(), annotationType, repeatableContainerType);
}
}
}
}
AnnotationUtils.java 文件源码
java
阅读 44
收藏 0
点赞 0
评论 0
项目:holon-core
作者:
评论列表
文章目录