Package org.apache.struts2.util
Class AnnotationUtils
java.lang.Object
org.apache.struts2.util.AnnotationUtils
AnnotationUtils
 Various utility methods dealing with annotations
- Version:
- $Id$
- Author:
- Rainer Hermanns, Zsolt Szasz, zsolt at lorecraft dot com, Dan Oxlade, dan d0t oxlade at gmail d0t c0m
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddAllFields(Class<? extends Annotation> annotationClass, Class<?> clazz, List<Field> allFields) Adds all fields with the specified Annotation of class clazz and its superclasses to allFieldsstatic voidaddAllInterfaces(Class<?> clazz, List<Class<?>> allInterfaces) static voidaddAllMethods(Class<? extends Annotation> annotationClass, Class<?> clazz, List<Method> allMethods) Adds all methods with the specified Annotation of class clazz and its superclasses to allFieldsstatic <T extends Annotation>
 TfindAnnotation(Class<?> clazz, Class<T> annotationClass) Returns the annotation on the given class or the package of the class.static <T extends Annotation>
 List<T>findAnnotations(Class<?> clazz, Class<T> annotationClass) Returns a list of the annotation on the given class or the package of the class.static booleanisAnnotatedBy(AnnotatedElement annotatedElement, Class<? extends Annotation>... annotation) Varargs version ofAnnotatedElement.isAnnotationPresent()static StringresolvePropertyName(Method method) Returns the property name for a method.
- 
Constructor Details- 
AnnotationUtilspublic AnnotationUtils()
 
- 
- 
Method Details- 
addAllFieldspublic 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- Parameters:
- annotationClass- the- Annotations to find
- clazz- The- Classto inspect
- allFields- list of all fields
 
- 
addAllMethodspublic 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- Parameters:
- annotationClass- the- Annotations to find
- clazz- The- Classto inspect
- allMethods- list of all methods
 
- 
addAllInterfaces- Parameters:
- clazz- The- Classto inspect
- allInterfaces- list of all interfaces
 
- 
resolvePropertyNameReturns the property name for a method. This method is independent from property fields.- Parameters:
- method- The method to get the property name for.
- Returns:
- the property name for given method; null if non could be resolved.
 
- 
findAnnotationReturns the annotation on the given class or the package of the class. This searches up the class hierarchy and the package hierarchy for the closest match.- Type Parameters:
- T- class type
- Parameters:
- clazz- The class to search for the annotation.
- annotationClass- The Class of the annotation.
- Returns:
- The annotation or null.
 
- 
findAnnotationspublic static <T extends Annotation> List<T> findAnnotations(Class<?> clazz, Class<T> annotationClass) Returns a list of the annotation on the given class or the package of the class. This searches up the class hierarchy and the package hierarchy.- Type Parameters:
- T- class type
- Parameters:
- clazz- The class to search for the annotation.
- annotationClass- The Class of the annotation.
- Returns:
- List of the annotations or an empty list.
 
- 
isAnnotatedBy@SafeVarargs public static boolean isAnnotatedBy(AnnotatedElement annotatedElement, Class<? extends Annotation>... annotation) Varargs version ofAnnotatedElement.isAnnotationPresent()- See Also:
 
 
-