@ComponentSpecification public interface AnnotationUtil
annotations.ReflectionUtil,
AnnotationUtilImpl| Modifier and Type | Field and Description |
|---|---|
static ElementType[] |
NO_TARGET
an empty element-type array
|
| Modifier and Type | Method and Description |
|---|---|
<A extends Annotation> |
getClassAnnotation(Class<?> annotatedClass,
Class<A> annotationClass)
This method gets the first
annotation of the type given by
annotation in the class hierarchy of the given
annotatedClass. |
<A extends Annotation> |
getMethodAnnotation(Method annotatedMethod,
Class<A> annotationClass)
This method gets the first
annotation of the type given by
annotation in the hierarchy of the given
method. |
<A extends Annotation> |
getTypeAnnotation(Class<?> annotatedType,
Class<A> annotationClass)
This method gets the first
annotation of the type given by
annotation in the declaration of the given annotatedType. |
<A extends Annotation> |
isAnnotationForType(Class<A> annotationType,
ElementType targetType)
This method determines if the given
annotationType represents an Annotation that has a
Target compatible with the given targetType. |
<A extends Annotation> |
isRuntimeAnnotation(Class<A> annotationType)
This method determines if the given
annotationType represents an Annotation that has the
Retention runtime and
can therefore be resolved at runtime. |
static final ElementType[] NO_TARGET
<A extends Annotation> boolean isRuntimeAnnotation(Class<A> annotationType)
annotationType represents an Annotation that has the
Retention runtime and
can therefore be resolved at runtime.A - is the type of the annotation to check.annotationType - is the type of the annotation to check.true if the given annotationType can be resolved at runtime.<A extends Annotation> boolean isAnnotationForType(Class<A> annotationType, ElementType targetType)
annotationType represents an Annotation that has a
Target compatible with the given targetType. A - is the type of the annotation to check.annotationType - is the type of the annotation to check.targetType - is the expected target-type to check.true if the given annotationType can be used to annotate elements of the given
targetType.<A extends Annotation> A getClassAnnotation(Class<?> annotatedClass, Class<A> annotationClass) throws IllegalArgumentException
annotation of the type given by
annotation in the class hierarchy of the given
annotatedClass. annotation is a runtime annotation that is applicable for
classes. If the annotation is inherited you may want to directly use Class.getAnnotation(Class) instead.A - is the type of the requested annotation.annotatedClass - is the class potentially annotated with the given annotation. This should
NOT be an interface, primitive,
array, enum, or annotation.annotationClass - is the type of the requested annotation.null if neither the annotatedClass nor one of its
super-classes are annotated with
the given annotation.IllegalArgumentException - if the given annotation is no runtime
annotation or is NOT applicable for
classes.getTypeAnnotation(Class, Class)<A extends Annotation> A getTypeAnnotation(Class<?> annotatedType, Class<A> annotationClass)
annotation of the type given by
annotation in the declaration of the given annotatedType. getClassAnnotation(Class, Class) this method will also scan implemented interfaces
for the given annotation. annotation is a
runtime annotation.A - is the type of the requested annotation.annotatedType - is the class or interface potentially annotated with the given annotation.
This should NOT be an primitive, array ,
enum , or annotation.annotationClass - is the type of the requested annotation.null if neither the annotatedType nor one of its
super-classes, or any implemented interfaces (no matter if implemented directly or indirectly) are
annotated with the given annotation.<A extends Annotation> A getMethodAnnotation(Method annotatedMethod, Class<A> annotationClass)
annotation of the type given by
annotation in the hierarchy of the given
method. annotation is a
runtime annotation.A - is the type of the requested annotation.annotatedMethod - is the method potentially annotated with the given annotation.annotationClass - is the type of the requested annotation.null if neither the annotatedMethod nor one of its
parent methods are
annotated with the given annotation.Copyright © 2001–2016 mmm-Team. All rights reserved.