Make findAnnotationAttributes power search private

This commit is contained in:
Sam Brannen
2015-05-02 10:38:31 +02:00
parent 7891c0d5ca
commit e56363737b

View File

@@ -176,9 +176,10 @@ public class AnnotatedElementUtils {
* in the annotation hierarchy of the supplied {@link AnnotatedElement},
* and merge the results into an {@link AnnotationAttributes} map.
*
* <p>Delegates to
* {@link #findAnnotationAttributes(AnnotatedElement, String, boolean, boolean, boolean, boolean, boolean, boolean)},
* supplying {@code true} for all {@code search*} flags.
* <p>If the annotated element is a class, this algorithm will additionally
* search on interfaces and superclasses.
* <p>If the annotated element is a method, this algorithm will additionally
* search on methods in interfaces and superclasses.
*
* @param element the annotated element; never {@code null}
* @param annotationType the annotation type to find; never {@code null}
@@ -196,9 +197,10 @@ public class AnnotatedElementUtils {
* in the annotation hierarchy of the supplied {@link AnnotatedElement},
* and merge the results into an {@link AnnotationAttributes} map.
*
* <p>Delegates to
* {@link #findAnnotationAttributes(AnnotatedElement, String, boolean, boolean, boolean, boolean, boolean, boolean)},
* supplying {@code true} for all {@code search*} flags.
* <p>If the annotated element is a class, this algorithm will additionally
* search on interfaces and superclasses.
* <p>If the annotated element is a method, this algorithm will additionally
* search on methods in interfaces and superclasses.
*
* @param element the annotated element; never {@code null}
* @param annotationType the fully qualified class name of the annotation
@@ -210,6 +212,33 @@ public class AnnotatedElementUtils {
return findAnnotationAttributes(element, annotationType, true, true, true, true, false, false);
}
/**
* <em>Find</em> annotation attributes of the specified {@code annotationType}
* in the annotation hierarchy of the supplied {@link AnnotatedElement},
* and merge the results into an {@link AnnotationAttributes} map.
*
* <p>If the annotated element is a class, this algorithm will additionally
* search on interfaces and superclasses.
* <p>If the annotated element is a method, this algorithm will additionally
* search on methods in interfaces and superclasses.
*
* @param element the annotated element; never {@code null}
* @param annotationType the fully qualified class name of the annotation
* type to find; never {@code null} or empty
* @param classValuesAsString whether to convert Class references into
* Strings or to preserve them as Class references
* @param nestedAnnotationsAsMap whether to convert nested Annotation
* instances into {@link AnnotationAttributes} maps or to preserve them
* as Annotation instances
* @return the merged {@code AnnotationAttributes}, or {@code null} if
* not found
*/
public static AnnotationAttributes findAnnotationAttributes(AnnotatedElement element, String annotationType,
boolean classValuesAsString, boolean nestedAnnotationsAsMap) {
return findAnnotationAttributes(element, annotationType, true, true, true, true, classValuesAsString,
nestedAnnotationsAsMap);
}
/**
* <em>Find</em> annotation attributes of the specified {@code annotationType}
* in the annotation hierarchy of the supplied {@link AnnotatedElement},
@@ -234,7 +263,7 @@ public class AnnotatedElementUtils {
* @return the merged {@code AnnotationAttributes}, or {@code null} if
* not found
*/
public static AnnotationAttributes findAnnotationAttributes(AnnotatedElement element, String annotationType,
private static AnnotationAttributes findAnnotationAttributes(AnnotatedElement element, String annotationType,
boolean searchOnInterfaces, boolean searchOnSuperclasses, boolean searchOnMethodsInInterfaces,
boolean searchOnMethodsInSuperclasses, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {