polishing
This commit is contained in:
@@ -50,6 +50,7 @@ public abstract class AnnotationUtils {
|
||||
/** The attribute name for annotations with a single element */
|
||||
static final String VALUE = "value";
|
||||
|
||||
|
||||
/**
|
||||
* Get all {@link Annotation Annotations} from the supplied {@link Method}.
|
||||
* <p>Correctly handles bridge {@link Method Methods} generated by the compiler.
|
||||
@@ -135,14 +136,16 @@ public abstract class AnnotationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a single {@link Annotation} of <code>annotationType</code> from the supplied {@link Class}, traversing its
|
||||
* interfaces and super classes if no annotation can be found on the given class itself. <p>This method explicitly
|
||||
* handles class-level annotations which are not declared as {@link java.lang.annotation.Inherited inherited} <i>as
|
||||
* well as annotations on interfaces</i>. <p>The algorithm operates as follows: Searches for an annotation on the given
|
||||
* class and returns it if found. Else searches all interfaces that the given class declares, returning the annotation
|
||||
* from the first matching candidate, if any. Else proceeds with introspection of the superclass of the given class,
|
||||
* checking the superclass itself; if no annotation found there, proceeds with the interfaces that the superclass
|
||||
* declares. Recursing up through the entire superclass hierarchy if no match is found.
|
||||
* Find a single {@link Annotation} of <code>annotationType</code> from the supplied {@link Class},
|
||||
* traversing its interfaces and super classes if no annotation can be found on the given class itself.
|
||||
* <p>This method explicitly handles class-level annotations which are not declared as
|
||||
* {@link Inherited inherited} <i>as well as annotations on interfaces</i>.
|
||||
* <p>The algorithm operates as follows: Searches for an annotation on the given class and returns
|
||||
* it if found. Else searches all interfaces that the given class declares, returning the annotation
|
||||
* from the first matching candidate, if any. Else proceeds with introspection of the superclass
|
||||
* of the given class, checking the superclass itself; if no annotation found there, proceeds
|
||||
* with the interfaces that the superclass declares. Recursing up through the entire superclass
|
||||
* hierarchy if no match is found.
|
||||
* @param clazz the class to look for annotations on
|
||||
* @param annotationType the annotation class to look for
|
||||
* @return the annotation found, or <code>null</code> if none found
|
||||
@@ -175,18 +178,21 @@ public abstract class AnnotationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first {@link Class} in the inheritance hierarchy of the specified <code>clazz</code> (including the
|
||||
* specified <code>clazz</code> itself) which declares an annotation for the specified <code>annotationType</code>, or
|
||||
* <code>null</code> if not found. If the supplied <code>clazz</code> is <code>null</code>, <code>null</code> will be
|
||||
* returned. <p>If the supplied <code>clazz</code> is an interface, only the interface itself will be checked; the
|
||||
* inheritance hierarchy for interfaces will not be traversed. <p>The standard {@link Class} API does not provide a
|
||||
* mechanism for determining which class in an inheritance hierarchy actually declares an {@link Annotation}, so we
|
||||
* need to handle this explicitly.
|
||||
* Find the first {@link Class} in the inheritance hierarchy of the specified <code>clazz</code>
|
||||
* (including the specified <code>clazz</code> itself) which declares an annotation for the
|
||||
* specified <code>annotationType</code>, or <code>null</code> if not found. If the supplied
|
||||
* <code>clazz</code> is <code>null</code>, <code>null</code> will be returned.
|
||||
* <p>If the supplied <code>clazz</code> is an interface, only the interface itself will be checked;
|
||||
* the inheritance hierarchy for interfaces will not be traversed.
|
||||
* <p>The standard {@link Class} API does not provide a mechanism for determining which class
|
||||
* in an inheritance hierarchy actually declares an {@link Annotation}, so we need to handle
|
||||
* this explicitly.
|
||||
* @param annotationType the Class object corresponding to the annotation type
|
||||
* @param clazz the Class object corresponding to the class on which to check for the annotation, or
|
||||
* <code>null</code>.
|
||||
* @return the first {@link Class} in the inheritance hierarchy of the specified <code>clazz</code> which
|
||||
* declares an annotation for the specified <code>annotationType</code>, or <code>null</code> if not found.
|
||||
* @param clazz the Class object corresponding to the class on which to check for the annotation,
|
||||
* or <code>null</code>
|
||||
* @return the first {@link Class} in the inheritance hierarchy of the specified <code>clazz</code>
|
||||
* which declares an annotation for the specified <code>annotationType</code>, or <code>null</code>
|
||||
* if not found
|
||||
* @see Class#isAnnotationPresent(Class)
|
||||
* @see Class#getDeclaredAnnotations()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user