Interface AnnotationDescription
-
- All Known Subinterfaces:
AnnotationDescription.Loadable<S>
- All Known Implementing Classes:
AnnotationDescription.AbstractBase
,AnnotationDescription.ForLoadedAnnotation
,AnnotationDescription.Latent
,AnnotationDescription.Latent.Loadable
,TypePool.Default.LazyTypeDescription.LazyAnnotationDescription
,TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.Loadable
public interface AnnotationDescription
An annotation description describesAnnotation
meta data of a class without this class being required to be loaded. All values of an annotation are therefore represented in unloaded state:Class
instances are represented asTypeDescription
s.Enum
instances are represented asEnumerationDescription
s.Annotation
s are described asAnnotationDescription
s.- All primitive types are represented as their wrapper types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AnnotationDescription.AbstractBase
An adapter implementation of an annotation.static class
AnnotationDescription.AnnotationInvocationHandler<T extends java.lang.annotation.Annotation>
AnInvocationHandler
for implementing annotations.static class
AnnotationDescription.Builder
A builder for pragmatically creatingAnnotationDescription
.static class
AnnotationDescription.ForLoadedAnnotation<S extends java.lang.annotation.Annotation>
A description of an already loaded annotation.static class
AnnotationDescription.Latent
A latent description of an annotation value that is defined explicitly.static interface
AnnotationDescription.Loadable<S extends java.lang.annotation.Annotation>
An annotation description that is linked to a given loaded annotation type which allows its representation as a fully loaded instance.static class
AnnotationDescription.RenderingDispatcher
A rendering dispatcher is responsible for resolving annotation descriptions toString
representations.
-
Field Summary
Fields Modifier and Type Field Description static AnnotationDescription.Loadable<?>
UNDEFINED
Indicates a nonexistent annotation in a type-safe manner.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TypeDescription
getAnnotationType()
Returns a description of the annotation type of this annotation.java.util.Set<java.lang.annotation.ElementType>
getElementTypes()
Returns a set of allElementType
s that can declare this annotation.java.lang.annotation.RetentionPolicy
getRetention()
Returns this annotation's retention policy.AnnotationValue<?,?>
getValue(java.lang.String property)
Returns a value of this annotation.AnnotationValue<?,?>
getValue(MethodDescription.InDefinedShape property)
Returns a value of this annotation.boolean
isDocumented()
Checks if this annotation is documented.boolean
isInherited()
Checks if this annotation is inherited.boolean
isSupportedOn(java.lang.annotation.ElementType elementType)
Checks if this annotation is supported on the supplied element type.boolean
isSupportedOn(java.lang.String elementType)
Checks if this annotation is supported on the supplied element type.<T extends java.lang.annotation.Annotation>
AnnotationDescription.Loadable<T>prepare(java.lang.Class<T> annotationType)
Links this annotation description to a given annotation type such that it can be loaded.
-
-
-
Field Detail
-
UNDEFINED
@AlwaysNull static final AnnotationDescription.Loadable<?> UNDEFINED
Indicates a nonexistent annotation in a type-safe manner.
-
-
Method Detail
-
getValue
AnnotationValue<?,?> getValue(java.lang.String property)
Returns a value of this annotation.- Parameters:
property
- The name of the property being accessed.- Returns:
- The value for the supplied property.
-
getValue
AnnotationValue<?,?> getValue(MethodDescription.InDefinedShape property)
Returns a value of this annotation.- Parameters:
property
- The property being accessed.- Returns:
- The value for the supplied property.
-
getAnnotationType
TypeDescription getAnnotationType()
Returns a description of the annotation type of this annotation.- Returns:
- A description of the annotation type of this annotation.
-
prepare
<T extends java.lang.annotation.Annotation> AnnotationDescription.Loadable<T> prepare(java.lang.Class<T> annotationType)
Links this annotation description to a given annotation type such that it can be loaded. This does not cause the values of this annotation to be loaded.- Type Parameters:
T
- The type of the annotation.- Parameters:
annotationType
- The loaded annotation type of this annotation description.- Returns:
- A loadable version of this annotation description.
-
getRetention
java.lang.annotation.RetentionPolicy getRetention()
Returns this annotation's retention policy.- Returns:
- This annotation's retention policy.
-
getElementTypes
java.util.Set<java.lang.annotation.ElementType> getElementTypes()
Returns a set of allElementType
s that can declare this annotation.- Returns:
- A set of all element types that can declare this annotation.
-
isSupportedOn
boolean isSupportedOn(java.lang.annotation.ElementType elementType)
Checks if this annotation is supported on the supplied element type.- Parameters:
elementType
- The element type to check.- Returns:
true
if the supplied element type is supported by this annotation.
-
isSupportedOn
boolean isSupportedOn(java.lang.String elementType)
Checks if this annotation is supported on the supplied element type.- Parameters:
elementType
- The element type to check.- Returns:
true
if the supplied element type is supported by this annotation.
-
isInherited
boolean isInherited()
Checks if this annotation is inherited.- Returns:
true
if this annotation is inherited.- See Also:
Inherited
-
isDocumented
boolean isDocumented()
Checks if this annotation is documented.- Returns:
true
if this annotation is documented.- See Also:
Documented
-
-