Polishing
This commit is contained in:
@@ -479,12 +479,12 @@ public class AnnotatedElementUtils {
|
||||
* @param annotationType the annotation type to find (never {@code null})
|
||||
* @return the set of all merged repeatable {@code Annotations} found,
|
||||
* or an empty set if none were found
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
* @since 4.3
|
||||
* @see #getMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
|
||||
* @see #getMergedRepeatableAnnotations(AnnotatedElement, Class, Class)
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
*/
|
||||
public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(AnnotatedElement element,
|
||||
Class<A> annotationType) {
|
||||
@@ -510,13 +510,13 @@ public class AnnotatedElementUtils {
|
||||
* {@link java.lang.annotation.Repeatable}
|
||||
* @return the set of all merged repeatable {@code Annotations} found,
|
||||
* or an empty set if none were found
|
||||
* @since 4.3
|
||||
* @see #getMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
* @throws AnnotationConfigurationException if the supplied {@code containerType}
|
||||
* is not a valid container annotation for the supplied {@code annotationType}
|
||||
* @since 4.3
|
||||
* @see #getMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
|
||||
*/
|
||||
public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(AnnotatedElement element,
|
||||
Class<A> annotationType, Class<? extends Annotation> containerType) {
|
||||
@@ -803,12 +803,12 @@ public class AnnotatedElementUtils {
|
||||
* @param annotationType the annotation type to find (never {@code null})
|
||||
* @return the set of all merged repeatable {@code Annotations} found,
|
||||
* or an empty set if none were found
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
* @since 4.3
|
||||
* @see #findMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #findAllMergedAnnotations(AnnotatedElement, Class)
|
||||
* @see #findMergedRepeatableAnnotations(AnnotatedElement, Class, Class)
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
*/
|
||||
public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(AnnotatedElement element,
|
||||
Class<A> annotationType) {
|
||||
@@ -834,13 +834,13 @@ public class AnnotatedElementUtils {
|
||||
* {@link java.lang.annotation.Repeatable}
|
||||
* @return the set of all merged repeatable {@code Annotations} found,
|
||||
* or an empty set if none were found
|
||||
* @since 4.3
|
||||
* @see #findMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #findAllMergedAnnotations(AnnotatedElement, Class)
|
||||
* @throws IllegalArgumentException if the {@code element} or {@code annotationType}
|
||||
* is {@code null}, or if the container type cannot be resolved
|
||||
* @throws AnnotationConfigurationException if the supplied {@code containerType}
|
||||
* is not a valid container annotation for the supplied {@code annotationType}
|
||||
* @since 4.3
|
||||
* @see #findMergedAnnotation(AnnotatedElement, Class)
|
||||
* @see #findAllMergedAnnotations(AnnotatedElement, Class)
|
||||
*/
|
||||
public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(AnnotatedElement element,
|
||||
Class<A> annotationType, Class<? extends Annotation> containerType) {
|
||||
@@ -1326,9 +1326,9 @@ public class AnnotatedElementUtils {
|
||||
* annotation for the supplied repeatable {@code annotationType} (i.e.,
|
||||
* that it declares a {@code value} attribute that holds an array of the
|
||||
* {@code annotationType}).
|
||||
* @since 4.3
|
||||
* @throws AnnotationConfigurationException if the supplied {@code containerType}
|
||||
* is not a valid container annotation for the supplied {@code annotationType}
|
||||
* @since 4.3
|
||||
*/
|
||||
private static void validateContainerType(Class<? extends Annotation> annotationType,
|
||||
Class<? extends Annotation> containerType) {
|
||||
@@ -1351,9 +1351,6 @@ public class AnnotatedElementUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.3
|
||||
*/
|
||||
private static <A extends Annotation> Set<A> postProcessAndSynthesizeAggregatedResults(AnnotatedElement element,
|
||||
Class<A> annotationType, List<AnnotationAttributes> aggregatedResults) {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib
|
||||
public void visitEnd() {
|
||||
super.visitEnd();
|
||||
|
||||
Class<?> annotationClass = this.attributes.annotationType();
|
||||
Class<? extends Annotation> annotationClass = this.attributes.annotationType();
|
||||
if (annotationClass != null) {
|
||||
List<AnnotationAttributes> attributeList = this.attributesMap.get(this.annotationType);
|
||||
if (attributeList == null) {
|
||||
@@ -72,21 +72,23 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib
|
||||
else {
|
||||
attributeList.add(0, this.attributes);
|
||||
}
|
||||
Set<Annotation> visited = new LinkedHashSet<Annotation>();
|
||||
Annotation[] metaAnnotations = AnnotationUtils.getAnnotations(annotationClass);
|
||||
if (!ObjectUtils.isEmpty(metaAnnotations)) {
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
if (!AnnotationUtils.isInJavaLangAnnotationPackage(metaAnnotation)) {
|
||||
recursivelyCollectMetaAnnotations(visited, metaAnnotation);
|
||||
if (!AnnotationUtils.isInJavaLangAnnotationPackage(annotationClass.getName())) {
|
||||
Set<Annotation> visited = new LinkedHashSet<Annotation>();
|
||||
Annotation[] metaAnnotations = AnnotationUtils.getAnnotations(annotationClass);
|
||||
if (!ObjectUtils.isEmpty(metaAnnotations)) {
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
if (!AnnotationUtils.isInJavaLangAnnotationPackage(metaAnnotation)) {
|
||||
recursivelyCollectMetaAnnotations(visited, metaAnnotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.metaAnnotationMap != null) {
|
||||
Set<String> metaAnnotationTypeNames = new LinkedHashSet<String>(visited.size());
|
||||
for (Annotation ann : visited) {
|
||||
metaAnnotationTypeNames.add(ann.annotationType().getName());
|
||||
if (this.metaAnnotationMap != null) {
|
||||
Set<String> metaAnnotationTypeNames = new LinkedHashSet<String>(visited.size());
|
||||
for (Annotation ann : visited) {
|
||||
metaAnnotationTypeNames.add(ann.annotationType().getName());
|
||||
}
|
||||
this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames);
|
||||
}
|
||||
this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user