org.jboss.lang
Class AnnotationHelper

java.lang.Object
  extended by org.jboss.lang.AnnotationHelper

public class AnnotationHelper
extends Object

AnnotationHelper.

Version:
$Revision: 227 $
Author:
Adrian Brock

Method Summary
static Annotation getAnnotation(AccessibleObject ao, Class annotationClass)
          Get an annotation
static Annotation getAnnotation(Class clazz, Class annotationClass)
          Get an annotation
static Annotation getAnnotation(Constructor constructor, Class annotationClass)
          Get an annotation
static Annotation getAnnotation(Field field, Class annotationClass)
          Get an annotation
static Annotation getAnnotation(Method method, Class annotationClass)
          Get an annotation
static Annotation getAnnotation(Object object, Class annotationClass)
          Get an annotation
static Annotation[] getAnnotations(AccessibleObject ao)
          Get annotations
static Annotation[] getAnnotations(Class clazz)
          Get annotations
static Annotation[] getAnnotations(Constructor constructor)
          Get annotations
static Annotation[] getAnnotations(Field field)
          Get annotations
static Annotation[] getAnnotations(Method method)
          Get annotations
static Annotation[] getAnnotations(Object object)
          Get an array of the annotations attached to this element.
static Object[] getAnnotationsInternal(Method method)
           
static Annotation[] getDeclaredAnnotations(AccessibleObject ao)
          Get declared annotations
static Annotation[] getDeclaredAnnotations(Class clazz)
          Get declared annotations
static Annotation[] getDeclaredAnnotations(Constructor constructor)
          Get declared annotations
static Annotation[] getDeclaredAnnotations(Field field)
          Get declared annotations
static Annotation[] getDeclaredAnnotations(Method method)
          Get declared annotations
static Annotation[] getDeclaredAnnotations(Object object)
          Get an array of the annotations attached to this element.
static Object[] getDeclaredAnnotationsInternal(Method method)
           
static Annotation[][] getParameterAnnotations(Constructor constructor)
          Get the parameter annotations
static Annotation[][] getParameterAnnotations(Method method)
          Get the parameter annotations
static boolean isAnnotationPresent(Class clazz, Class annotationClass)
          Whether an annotation is present
static boolean isAnnotationPresent(Constructor constructor, Class annotationClass)
          Whether an annotation is present
static boolean isAnnotationPresent(Field field, Class annotationClass)
          Whether an annotation is present
static boolean isAnnotationPresent(Method method, Class annotationClass)
          Whether an annotation is present
static boolean isAnnotationPresent(Object obj, Class annotationClass)
          Whether an annotation is present
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isAnnotationPresent

public static boolean isAnnotationPresent(Class clazz,
                                          Class annotationClass)
Whether an annotation is present

Parameters:
clazz - the class
annotationClass - the annotation class
Returns:
true when the annotation is present

getAnnotation

public static Annotation getAnnotation(Class clazz,
                                       Class annotationClass)
Get an annotation

Parameters:
clazz - the class
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(Class clazz)
Get annotations

Parameters:
clazz - the class
Returns:
the annotations

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(Class clazz)
Get declared annotations

Parameters:
clazz - the class
Returns:
the annotations

isAnnotationPresent

public static boolean isAnnotationPresent(Object obj,
                                          Class annotationClass)
Whether an annotation is present

Parameters:
ao - the accessible object
annotationClass - the annotation class
Returns:
true when the annotation is present

getAnnotation

public static Annotation getAnnotation(AccessibleObject ao,
                                       Class annotationClass)
Get an annotation

Parameters:
ao - the accessible object
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(AccessibleObject ao)
Get annotations

Parameters:
ao - the accessible object
Returns:
the annotations

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(AccessibleObject ao)
Get declared annotations

Parameters:
ao - the accessible object
Returns:
the annotations

isAnnotationPresent

public static boolean isAnnotationPresent(Method method,
                                          Class annotationClass)
Whether an annotation is present

Parameters:
method - the method
annotationClass - the annotation class
Returns:
true when the annotation is present

getAnnotation

public static Annotation getAnnotation(Method method,
                                       Class annotationClass)
Get an annotation

Parameters:
method - the method
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(Object object)
Get an array of the annotations attached to this element. TODO: currently does not include inherited annotations, this should be added.

Returns:

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(Object object)
Get an array of the annotations attached to this element. (Includes inherited annotations) TODO: this should not include inherited annotations.

Returns:

getAnnotation

public static Annotation getAnnotation(Object object,
                                       Class annotationClass)
Get an annotation

Parameters:
object - the the annotated element
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(Method method)
Get annotations

Parameters:
method - the method
Returns:
the annotations

getAnnotationsInternal

public static Object[] getAnnotationsInternal(Method method)

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(Method method)
Get declared annotations

Parameters:
method - the method
Returns:
the annotations

getDeclaredAnnotationsInternal

public static Object[] getDeclaredAnnotationsInternal(Method method)

getParameterAnnotations

public static Annotation[][] getParameterAnnotations(Method method)
Get the parameter annotations

Parameters:
method - the method
Returns:
the annotations

isAnnotationPresent

public static boolean isAnnotationPresent(Constructor constructor,
                                          Class annotationClass)
Whether an annotation is present

Parameters:
constructor - the constructor
annotationClass - the annotation class
Returns:
true when the annotation is present

getAnnotation

public static Annotation getAnnotation(Constructor constructor,
                                       Class annotationClass)
Get an annotation

Parameters:
constructor - the constructor
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(Constructor constructor)
Get annotations

Parameters:
constructor - the constructor
Returns:
the annotations

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(Constructor constructor)
Get declared annotations

Parameters:
constructor - the constructor
Returns:
the annotations

getParameterAnnotations

public static Annotation[][] getParameterAnnotations(Constructor constructor)
Get the parameter annotations

Parameters:
constructor - the constructor
Returns:
the annotations

isAnnotationPresent

public static boolean isAnnotationPresent(Field field,
                                          Class annotationClass)
Whether an annotation is present

Parameters:
field - the field
annotationClass - the annotation class
Returns:
true when the annotation is present

getAnnotation

public static Annotation getAnnotation(Field field,
                                       Class annotationClass)
Get an annotation

Parameters:
field - the field
annotationClass - the annotation class
Returns:
the annotation

getAnnotations

public static Annotation[] getAnnotations(Field field)
Get annotations

Parameters:
field - the field
Returns:
the annotations

getDeclaredAnnotations

public static Annotation[] getDeclaredAnnotations(Field field)
Get declared annotations

Parameters:
field - the field
Returns:
the annotations


Copyright © 2005-2007 JBoss, a division of Red Hat, Inc. All Rights Reserved.