Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2.util
Class AnnotationUtils

    java.lang.Object
      com.opensymphony.xwork2.util.AnnotationUtils

    public class AnnotationUtils

extends Object

`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 Summary
`AnnotationUtils()`

Method Summary
`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> T`
` | `findAnnotation(Class<?> klass, 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 `AnnotatedElement`s that match the given `annotation`s or if no `annotation`s 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AnnotationUtils

    public AnnotationUtils()

Method Detail

### addAllFields

    public 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` -
    `clazz` -
    `allFields` -

### addAllMethods

    public 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` -
    `clazz` -
    `allMethods` -

### addAllInterfaces

    public static void addAllInterfaces(Class clazz,
                                        List<Class> allInterfaces)

  Parameters:
    `clazz` -
    `allInterfaces` -

### getAnnotatedMethods

    public static Collection<Method> getAnnotatedMethods(Class clazz,
                                                         Class<? extends Annotation>... annotation)

  For the given `Class` get a collection of the the `AnnotatedElement`s that match the given `annotation`s or if no `annotation`s are specified then return all of the annotated elements of the given `Class`. Includes only the method level annotations.

  Parameters:
    `clazz` - The `Class` to inspect
    `annotation` - the `Annotation`s to find
  Returns:
    A `Collection`<`AnnotatedElement`> containing all of the method `AnnotatedElement`s matching the specified `Annotation`s

### isAnnotatedBy

    public static boolean isAnnotatedBy(AnnotatedElement annotatedElement,
                                        Class<? extends Annotation>... annotation)

  Varargs version of `AnnotatedElement.isAnnotationPresent()`

  See Also:
    `AnnotatedElement`

### resolvePropertyName

    public static String resolvePropertyName(Method method)

  Returns 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.

### findAnnotation

    public static <T extends Annotation> T findAnnotation(Class<?> klass,
                                                          Class<T> annotationClass)

  Returns the annotation on the given class or the package of the class. This searchs up the class hierarchy and the package hierarchy for the closest match.

  Parameters:
    `klass` - The class to search for the annotation.
    `annotationClass` - The Class of the annotation.
  Returns:
    The annotation or null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.