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}, * in the annotation hierarchy of the supplied {@link AnnotatedElement},
* and merge the results into an {@link AnnotationAttributes} map. * and merge the results into an {@link AnnotationAttributes} map.
* *
* <p>Delegates to * <p>If the annotated element is a class, this algorithm will additionally
* {@link #findAnnotationAttributes(AnnotatedElement, String, boolean, boolean, boolean, boolean, boolean, boolean)}, * search on interfaces and superclasses.
* supplying {@code true} for all {@code search*} flags. * <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 element the annotated element; never {@code null}
* @param annotationType the annotation type to find; 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}, * in the annotation hierarchy of the supplied {@link AnnotatedElement},
* and merge the results into an {@link AnnotationAttributes} map. * and merge the results into an {@link AnnotationAttributes} map.
* *
* <p>Delegates to * <p>If the annotated element is a class, this algorithm will additionally
* {@link #findAnnotationAttributes(AnnotatedElement, String, boolean, boolean, boolean, boolean, boolean, boolean)}, * search on interfaces and superclasses.
* supplying {@code true} for all {@code search*} flags. * <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 element the annotated element; never {@code null}
* @param annotationType the fully qualified class name of the annotation * @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); 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} * <em>Find</em> annotation attributes of the specified {@code annotationType}
* in the annotation hierarchy of the supplied {@link AnnotatedElement}, * 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 * @return the merged {@code AnnotationAttributes}, or {@code null} if
* not found * 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 searchOnInterfaces, boolean searchOnSuperclasses, boolean searchOnMethodsInInterfaces,
boolean searchOnMethodsInSuperclasses, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { boolean searchOnMethodsInSuperclasses, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {