org.apache.webbeans.util
Class AnnotationUtil

java.lang.Object
  extended by org.apache.webbeans.util.AnnotationUtil

public final class AnnotationUtil
extends Object

Utility class related with Annotation operations.

Since:
1.0
Author:
Gurkan Erdogdu

Field Summary
static Annotation[] EMPTY_ANNOTATION_ARRAY
           
static Object[] EMPTY_OBJECT_ARRAY
           
 
Method Summary
static
<X,T extends Annotation>
T
getAnnotatedMethodFirstParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<T> clazz)
           
static
<X> Annotation[]
getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
          Deprecated. 
static
<X> Type
getAnnotatedMethodFirstParameterWithAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
           
static
<T extends Annotation>
T
getAnnotation(Annotation[] anns, Class<T> annotation)
          get the annotation of the given type from the array.
static Annotation[] getAnnotationsFromSet(Set<Annotation> set)
           
static Type[] getConstructorParameterGenericTypesWithGivenAnnotation(Constructor<?> constructor, Class<? extends Annotation> clazz)
           
static Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
          Deprecated. 
static Annotation[] getMetaAnnotations(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
          Returns a subset of annotations that are annotated with the specified meta-annotation
static
<T extends Annotation>
T
getMethodFirstParameterAnnotation(Method method, Class<T> clazz)
          Gets the method first found parameter annotation with given type.
static Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
          Deprecated. 
static Class<?> getMethodFirstParameterTypeClazzWithAnnotation(Method method, Class<? extends Annotation> clazz)
           
static Type getMethodFirstParameterWithAnnotation(Method method, Class<? extends Annotation> clazz)
          Gets the method first found parameter type that is annotated with the given annotation.
static Type[] getMethodParameterGenericTypesWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
           
static Method[] getMethodsWithParameterAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
          Gets array of methods that has parameter with given annotation type.
static Annotation[] getQualifierAnnotations(Annotation... annotations)
          Deprecated. 
static Annotation[] getRealizesGenericAnnotations(Class<?> clazz, Annotation[] anns)
          Deprecated. 
static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
          Deprecated. 
static Type getTypeOfParameterWithGivenAnnotation(Method method, Class<? extends Annotation> clazz)
          Get the Type of the method parameter which has the given annotation
static
<X> boolean
hasAnnotatedMethodMultipleParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
           
static
<X> boolean
hasAnnotatedMethodParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod, Class<? extends Annotation> clazz)
           
static boolean hasAnnotation(Annotation[] anns, Class<? extends Annotation> annotation)
           
static boolean hasAnyQualifier(javax.enterprise.inject.spi.Bean<?> bean)
          Returns true if any binding exist
static boolean hasClassAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
          Check whether or not class contains the given annotation.
static boolean hasMetaAnnotation(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
           
static boolean hasMethodAnnotation(Method method, Class<? extends Annotation> clazz)
          Check given annotation exist on the method.
static boolean hasMethodMultipleParameterAnnotation(Method method, Class<? extends Annotation> clazz)
          Check given annotation exist in the multiple parameter of the given method.
static boolean hasMethodParameterAnnotation(Method method, Class<? extends Annotation> clazz)
          Check given annotation exist in the any parameter of the given method.
static boolean hasMethodParameterAnnotationCrossRef(Method method, Class<? extends Annotation> clazz)
          Check given annotation cross ref exist in the any parameter of the given method.
static Annotation hasOwbInjectableResource(Annotation[] annotations)
           
static boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
          Deprecated. 
static boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
          Deprecated. 
static boolean isQualifierEqual(Annotation qualifier1, Annotation qualifier2)
          Checks if the given qualifiers are equal.
static boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ANNOTATION_ARRAY

public static final Annotation[] EMPTY_ANNOTATION_ARRAY

EMPTY_OBJECT_ARRAY

public static final Object[] EMPTY_OBJECT_ARRAY
Method Detail

hasMethodAnnotation

public static boolean hasMethodAnnotation(Method method,
                                          Class<? extends Annotation> clazz)
Check given annotation exist on the method.

Parameters:
method - method
clazz - annotation class
Returns:
true or false

hasMethodParameterAnnotation

public static boolean hasMethodParameterAnnotation(Method method,
                                                   Class<? extends Annotation> clazz)
Check given annotation exist in the any parameter of the given method. Return true if exist false otherwise.

Parameters:
method - method
clazz - checking annotation
Returns:
true or false

hasAnnotatedMethodParameterAnnotation

public static <X> boolean hasAnnotatedMethodParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
                                                                Class<? extends Annotation> clazz)

getMethodParameterGenericTypesWithGivenAnnotation

public static Type[] getMethodParameterGenericTypesWithGivenAnnotation(Method method,
                                                                       Class<? extends Annotation> clazz)

getConstructorParameterGenericTypesWithGivenAnnotation

public static Type[] getConstructorParameterGenericTypesWithGivenAnnotation(Constructor<?> constructor,
                                                                            Class<? extends Annotation> clazz)

hasMethodMultipleParameterAnnotation

public static boolean hasMethodMultipleParameterAnnotation(Method method,
                                                           Class<? extends Annotation> clazz)
Check given annotation exist in the multiple parameter of the given method. Return true if exist false otherwise.

Parameters:
method - method
clazz - checking annotation
Returns:
true or false

hasAnnotatedMethodMultipleParameterAnnotation

public static <X> boolean hasAnnotatedMethodMultipleParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
                                                                        Class<? extends Annotation> clazz)

getMethodFirstParameterWithAnnotation

public static Type getMethodFirstParameterWithAnnotation(Method method,
                                                         Class<? extends Annotation> clazz)
Gets the method first found parameter type that is annotated with the given annotation.

Parameters:
method - method
clazz - checking annotation
Returns:
type

getAnnotatedMethodFirstParameterWithAnnotation

public static <X> Type getAnnotatedMethodFirstParameterWithAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
                                                                      Class<? extends Annotation> clazz)

getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation

@Deprecated
public static <X> Annotation[] getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
                                                                                                       Class<? extends Annotation> clazz)
Deprecated. 


getMethodFirstParameterTypeClazzWithAnnotation

public static Class<?> getMethodFirstParameterTypeClazzWithAnnotation(Method method,
                                                                      Class<? extends Annotation> clazz)

getMethodFirstParameterQualifierWithGivenAnnotation

@Deprecated
public static Annotation[] getMethodFirstParameterQualifierWithGivenAnnotation(Method method,
                                                                                          Class<? extends Annotation> clazz)
Deprecated. 

Gets the method first found parameter qualifiers.

Parameters:
method - method
clazz - checking annotation
Returns:
annotation array

getTypeOfParameterWithGivenAnnotation

public static Type getTypeOfParameterWithGivenAnnotation(Method method,
                                                         Class<? extends Annotation> clazz)
Get the Type of the method parameter which has the given annotation

Parameters:
method - which need to be scanned
clazz - the annotation to scan the method parameters for
Returns:
the Type of the method parameter which has the given annotation, or null if not found.

getMethodFirstParameterAnnotation

public static <T extends Annotation> T getMethodFirstParameterAnnotation(Method method,
                                                                         Class<T> clazz)
Gets the method first found parameter annotation with given type.

Parameters:
method - method
clazz - checking annotation
Returns:
annotation

getAnnotatedMethodFirstParameterAnnotation

public static <X,T extends Annotation> T getAnnotatedMethodFirstParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
                                                                                    Class<T> clazz)

hasMethodParameterAnnotationCrossRef

public static boolean hasMethodParameterAnnotationCrossRef(Method method,
                                                           Class<? extends Annotation> clazz)
Check given annotation cross ref exist in the any parameter of the given method. Return true if exist false otherwise.

Parameters:
method - method
clazz - checking annotation
Returns:
true or false

isQualifierEqual

public static boolean isQualifierEqual(Annotation qualifier1,
                                       Annotation qualifier2)
Checks if the given qualifiers are equal. Qualifiers are equal if they have the same annotationType and all their methods, except those annotated with @Nonbinding, return the same value.

Parameters:
qualifier1 -
qualifier2 -
Returns:

getQualifierAnnotations

@Deprecated
public static Annotation[] getQualifierAnnotations(Annotation... annotations)
Deprecated. 

Gets the array of qualifier annotations on the given array.

Parameters:
annotations - annotation array
Returns:
array containing qualifier anns

getMethodsWithParameterAnnotation

public static Method[] getMethodsWithParameterAnnotation(Class<?> clazz,
                                                         Class<? extends Annotation> annotation)
Gets array of methods that has parameter with given annotation type.

Parameters:
clazz - class for check
annotation - for check
Returns:
array of methods

hasClassAnnotation

public static boolean hasClassAnnotation(Class<?> clazz,
                                         Class<? extends Annotation> annotation)
Check whether or not class contains the given annotation.

Parameters:
clazz - class instance
annotation - annotation class
Returns:
return true or false

hasMetaAnnotation

public static boolean hasMetaAnnotation(Annotation[] anns,
                                        Class<? extends Annotation> metaAnnotation)

hasAnnotation

public static boolean hasAnnotation(Annotation[] anns,
                                    Class<? extends Annotation> annotation)

getAnnotation

public static <T extends Annotation> T getAnnotation(Annotation[] anns,
                                                     Class<T> annotation)
get the annotation of the given type from the array.

Parameters:
anns -
annotation -
Returns:
the Annotation with the given type or null if no such found.

getMetaAnnotations

public static Annotation[] getMetaAnnotations(Annotation[] anns,
                                              Class<? extends Annotation> metaAnnotation)
Returns a subset of annotations that are annotated with the specified meta-annotation

Parameters:
anns -
metaAnnotation -
Returns:

hasAnyQualifier

public static boolean hasAnyQualifier(javax.enterprise.inject.spi.Bean<?> bean)
Returns true if any binding exist

Parameters:
bean - bean
Returns:
true if any binding exist

hasOwbInjectableResource

public static Annotation hasOwbInjectableResource(Annotation[] annotations)

isInterceptorBindingAnnotation

@Deprecated
public static boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz)
Deprecated. 

Returns true if the annotation is defined in xml or annotated with InterceptorBinding false otherwise.

Parameters:
clazz - type of the annotation
Returns:
true if the annotation is defined in xml or annotated with InterceptorBinding false otherwise

getInterceptorBindingMetaAnnotations

@Deprecated
public static Annotation[] getInterceptorBindingMetaAnnotations(Annotation[] anns)
Deprecated. 

Collect the interceptor bindings from an array of annotations, including transitively defined interceptor bindings.

Parameters:
anns - An array of annotations
Returns:
an array of interceptor binding annotations, including the input and any transitively declared annotations

getStereotypeMetaAnnotations

@Deprecated
public static Annotation[] getStereotypeMetaAnnotations(Annotation[] anns)
Deprecated. 


hasStereoTypeMetaAnnotation

@Deprecated
public static boolean hasStereoTypeMetaAnnotation(Annotation[] anns)
Deprecated. 


isStereoTypeAnnotation

@Deprecated
public static boolean isStereoTypeAnnotation(Class<? extends Annotation> clazz)
Deprecated. 

Returns true if the annotation is defined in xml or annotated with Stereotype false otherwise.

Parameters:
clazz - type of the annotation
Returns:
true if the annotation is defined in xml or annotated with Stereotype false otherwise

getRealizesGenericAnnotations

@Deprecated
public static Annotation[] getRealizesGenericAnnotations(Class<?> clazz,
                                                                    Annotation[] anns)
Deprecated. 

If the bean extends generic class via Realizes annotation, realized based producer methods, fields and observer methods qualifier is

Parameters:
clazz - realized definition class
anns - binding annotations array

getAnnotationsFromSet

public static Annotation[] getAnnotationsFromSet(Set<Annotation> set)


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.