com.opensymphony.xwork.util
Class AnnotationUtils

java.lang.Object
  extended by com.opensymphony.xwork.util.AnnotationUtils

public class AnnotationUtils
extends Object

AnnotationUtils Various utility methods dealing with annotations

Version:
$Id: AnnotationUtils.java 860 2006-03-03 16:10:09 +0100 (Fri, 03 Mar 2006) rainerh $
Author:
Rainer Hermanns, Zsolt Szasz, zsolt at lorecraft dot com

Constructor Summary
AnnotationUtils()
           
 
Method Summary
static void addAllFields(Class 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 allInterfaces)
           
static void addAllMethods(Class annotationClass, Class clazz, List<Method> allMethods)
          Adds all methods with the specified Annotation of class clazz and its superclasses to allFields
static String[] find(Class clazz, String pckgname)
          Retrieves all classes within a packages.
static List<Method> findAnnotatedMethods(Class clazz, Class<? extends Annotation> annotationClass)
           
static void findRecursively(Class clazz, Class<? extends Annotation> annotationClass, List<Method> methods)
           
static String resolvePropertyName(Method method)
          Returns the property name for a method.
static String resolvePropertyName(com.sun.mirror.declaration.MethodDeclaration 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 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 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 allInterfaces)
Parameters:
clazz -
allInterfaces -

findAnnotatedMethods

public static List<Method> findAnnotatedMethods(Class clazz,
                                                Class<? extends Annotation> annotationClass)

findRecursively

public static void findRecursively(Class clazz,
                                   Class<? extends Annotation> annotationClass,
                                   List<Method> methods)

resolvePropertyName

public static String resolvePropertyName(com.sun.mirror.declaration.MethodDeclaration method)
Returns the property name for a method. This method is independant 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.

resolvePropertyName

public static String resolvePropertyName(Method method)
Returns the property name for a method. This method is independant 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.

find

public static String[] find(Class clazz,
                            String pckgname)
Retrieves all classes within a packages. TODO: this currently does not work with jars.

Parameters:
pckgname -
Returns:
Array of full qualified class names from this package.

XWork Project Page