public final class AnnotationUtil extends Object
Annotation operations.| Modifier and Type | Field and Description |
|---|---|
static Annotation[] |
DEFAULT_AND_ANY_ANNOTATION_ARRAY |
static Set<Annotation> |
DEFAULT_AND_ANY_ANNOTATION_SET |
static Annotation[] |
EMPTY_ANNOTATION_ARRAY |
static Object[] |
EMPTY_OBJECT_ARRAY |
| Modifier and Type | Method and Description |
|---|---|
static Annotation[] |
asArray(Collection<Annotation> set) |
static <T extends Annotation> |
getAnnotation(Annotation[] anns,
Class<T> annotation)
get the annotation of the given type from the array.
|
static <T extends Annotation> |
getAnnotation(Set<Annotation> annotations,
Class<T> annotationClass)
Search in the given Set of Annotations for the one with the given AnnotationClass.
|
static int |
getCdiAnnotationHashCode(Annotation annotation)
Computes a hash code for the specified cdi annoation. cdi annotations may either be qualifiers or interceptor bindings.
|
static Class<?> |
getDeclaringClass(Annotation declaredAnnotation,
Class<?> typeHierarchy)
Returns the declaring class for the specified annotation, using the specified type hierarchy.
|
static <X> javax.enterprise.inject.spi.AnnotatedParameter<X> |
getFirstAnnotatedParameter(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
Class<? extends Annotation> annotation) |
static Annotation[] |
getMetaAnnotations(Annotation[] anns,
Class<? extends Annotation> metaAnnotation)
Returns a subset of annotations that are annotated with the specified meta-annotation
|
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 |
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 Annotation |
hasOwbInjectableResource(Annotation[] annotations) |
static boolean |
isCdiAnnotationEqual(javax.enterprise.inject.spi.AnnotatedType<?> at,
Annotation annotation1,
Annotation annotation2)
Checks if the given cdi annotations are equal. cdi annotations may either be qualifiers or interceptor bindings.
|
static boolean |
isCdiAnnotationEqual(Annotation annotation1,
Annotation annotation2) |
static boolean |
isDeclaringClass(Class<?> declaringClass,
Annotation declaredAnnotation)
Checks, if the given class declares the specified annotation
|
public static final Annotation[] EMPTY_ANNOTATION_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
public static final Annotation[] DEFAULT_AND_ANY_ANNOTATION_ARRAY
public static final Set<Annotation> DEFAULT_AND_ANY_ANNOTATION_SET
public static boolean isDeclaringClass(Class<?> declaringClass, Annotation declaredAnnotation)
public static Class<?> getDeclaringClass(Annotation declaredAnnotation, Class<?> typeHierarchy)
public static boolean hasMethodAnnotation(Method method, Class<? extends Annotation> clazz)
method - methodclazz - annotation classpublic static <X> boolean hasAnnotatedMethodParameterAnnotation(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
Class<? extends Annotation> clazz)
public static <X> javax.enterprise.inject.spi.AnnotatedParameter<X> getFirstAnnotatedParameter(javax.enterprise.inject.spi.AnnotatedMethod<X> annotatedMethod,
Class<? extends Annotation> annotation)
public static boolean isCdiAnnotationEqual(javax.enterprise.inject.spi.AnnotatedType<?> at,
Annotation annotation1,
Annotation annotation2)
annotation1 - annotation2 - public static boolean isCdiAnnotationEqual(Annotation annotation1, Annotation annotation2)
public static int getCdiAnnotationHashCode(Annotation annotation)
annotation - public static boolean hasClassAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
clazz - class instanceannotation - annotation classpublic static boolean hasMetaAnnotation(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
public static boolean hasAnnotation(Annotation[] anns, Class<? extends Annotation> annotation)
public static <T extends Annotation> T getAnnotation(Annotation[] anns, Class<T> annotation)
anns - annotation - null if no such found.public static Annotation[] getMetaAnnotations(Annotation[] anns, Class<? extends Annotation> metaAnnotation)
anns - metaAnnotation - public static <T extends Annotation> T getAnnotation(Set<Annotation> annotations, Class<T> annotationClass)
annotations - to scanannotationClass - to search fornull if not found.public static Annotation hasOwbInjectableResource(Annotation[] annotations)
public static Annotation[] asArray(Collection<Annotation> set)
Copyright © 2008–2020 The Apache Software Foundation. All rights reserved.