|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@ComponentSpecification public interface AnnotationUtil
This is the interface for a collection of utility functions to deal with
annotations.
AnnotationUtil| Field Summary | |
|---|---|
static ElementType[] |
NO_TARGET
an empty element-type array |
| Method Summary | ||
|---|---|---|
|
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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
| Field Detail |
|---|
static final ElementType[] NO_TARGET
| Method Detail |
|---|
<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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||