public class AnnotationUtils extends Object
AnnotationUtils
Various utility methods dealing with annotations
| Constructor and Description |
|---|
AnnotationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAllFields(Class<? extends Annotation> annotationClass,
Class clazz,
List<Field> allFields)
Adds all fields with the specified Annotation of class clazz and its superclasses to allFields
|
static void |
addAllInterfaces(Class clazz,
List<Class> allInterfaces) |
static void |
addAllMethods(Class<? extends Annotation> annotationClass,
Class clazz,
List<Method> allMethods)
Adds all methods with the specified Annotation of class clazz and its superclasses to allFields
|
static <T extends Annotation> |
findAnnotation(Class<?> clazz,
Class<T> annotationClass)
Returns the annotation on the given class or the package of the class.
|
static Collection<Method> |
getAnnotatedMethods(Class clazz,
Class<? extends Annotation>... annotation)
For the given
Class get a collection of the the AnnotatedElements
that match the given annotations or if no annotations are
specified then return all of the annotated elements of the given Class. |
static boolean |
isAnnotatedBy(AnnotatedElement annotatedElement,
Class<? extends Annotation>... annotation)
Varargs version of
AnnotatedElement.isAnnotationPresent() |
static String |
resolvePropertyName(Method method)
Returns the property name for a method.
|
public static void addAllFields(Class<? extends Annotation> annotationClass, Class clazz, List<Field> allFields)
annotationClass - the Annotations to findclazz - The Class to inspectallFields - list of all fieldspublic static void addAllMethods(Class<? extends Annotation> annotationClass, Class clazz, List<Method> allMethods)
annotationClass - the Annotations to findclazz - The Class to inspectallMethods - list of all methodspublic static void addAllInterfaces(Class clazz, List<Class> allInterfaces)
clazz - The Class to inspectallInterfaces - list of all interfacespublic static Collection<Method> getAnnotatedMethods(Class clazz, Class<? extends Annotation>... annotation)
Class get a collection of the the AnnotatedElements
that match the given annotations or if no annotations are
specified then return all of the annotated elements of the given Class.
Includes only the method level annotations.clazz - The Class to inspectannotation - the Annotations to findCollection<AnnotatedElement> containing all of the
method AnnotatedElements matching the specified Annotationspublic static boolean isAnnotatedBy(AnnotatedElement annotatedElement, Class<? extends Annotation>... annotation)
AnnotatedElement.isAnnotationPresent()annotatedElement - element to checkannotation - the Annotations to findAnnotatedElementpublic static String resolvePropertyName(Method method)
method - The method to get the property name for.public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass)
T - class typeclazz - The class to search for the annotation.annotationClass - The Class of the annotation.Copyright © 2000–2017 Apache Software Foundation. All rights reserved.