Package net.bytebuddy.pool
Class TypePool.Default.LazyTypeDescription.LazyAnnotationDescription
java.lang.Object
net.bytebuddy.description.annotation.AnnotationDescription.AbstractBase
net.bytebuddy.pool.TypePool.Default.LazyTypeDescription.LazyAnnotationDescription
- All Implemented Interfaces:
AnnotationDescription
- Direct Known Subclasses:
TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.Loadable
- Enclosing class:
- TypePool.Default.LazyTypeDescription
private static class TypePool.Default.LazyTypeDescription.LazyAnnotationDescription
extends AnnotationDescription.AbstractBase
A lazy description of an annotation that looks up types from a type pool when required.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A loadable version of a lazy annotation description.Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationDescription
AnnotationDescription.AbstractBase, AnnotationDescription.AnnotationInvocationHandler<T extends Annotation>, AnnotationDescription.Builder, AnnotationDescription.ForLoadedAnnotation<S extends Annotation>, AnnotationDescription.Latent, AnnotationDescription.RenderingDispatcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeDescription
The type of this annotation.protected final TypePool
The type pool for looking up type references.protected final Map<String,
AnnotationValue<?, ?>> A map of annotation values by their property name.Fields inherited from interface net.bytebuddy.description.annotation.AnnotationDescription
UNDEFINED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
LazyAnnotationDescription
(TypePool typePool, TypeDescription annotationType, Map<String, AnnotationValue<?, ?>> values) Creates a new lazy annotation description. -
Method Summary
Modifier and TypeMethodDescriptionprotected static AnnotationList
asList
(TypePool typePool, List<? extends TypePool.Default.LazyTypeDescription.AnnotationToken> tokens) Represents a list of annotation tokens in form of a list of lazy type annotations.protected static AnnotationList
asListOfNullable
(TypePool typePool, List<? extends TypePool.Default.LazyTypeDescription.AnnotationToken> tokens) Represents a list of annotation tokens in form of a list of lazy type annotations.Returns a description of the annotation type of this annotation.AnnotationValue<?,
?> getValue
(MethodDescription.InDefinedShape property) Returns a value of this annotation.Links this annotation description to a given annotation type such that it can be loaded.Methods inherited from class net.bytebuddy.description.annotation.AnnotationDescription.AbstractBase
equals, getElementTypes, getRetention, getValue, hashCode, isDocumented, isInherited, isSupportedOn, isSupportedOn, toString
-
Field Details
-
typePool
The type pool for looking up type references. -
annotationType
The type of this annotation. -
values
A map of annotation values by their property name.
-
-
Constructor Details
-
LazyAnnotationDescription
private LazyAnnotationDescription(TypePool typePool, TypeDescription annotationType, Map<String, AnnotationValue<?, ?>> values) Creates a new lazy annotation description.- Parameters:
typePool
- The type pool to be used for looking up linked types.annotationType
- The annotation's type.values
- A map of annotation value names to their value representations.
-
-
Method Details
-
asListOfNullable
protected static AnnotationList asListOfNullable(TypePool typePool, @MaybeNull List<? extends TypePool.Default.LazyTypeDescription.AnnotationToken> tokens) Represents a list of annotation tokens in form of a list of lazy type annotations. Any annotation with a type that cannot be loaded from the type pool is ignored and not included in the list. If the providedtokens
arenull
, an empty list is returned.- Parameters:
typePool
- The type pool to be used for looking up linked types.tokens
- The tokens to represent in the list.- Returns:
- A list of the loadable annotations.
-
asList
protected static AnnotationList asList(TypePool typePool, List<? extends TypePool.Default.LazyTypeDescription.AnnotationToken> tokens) Represents a list of annotation tokens in form of a list of lazy type annotations. Any annotation with a type that cannot be loaded from the type pool is ignored and not included in the list.- Parameters:
typePool
- The type pool to be used for looking up linked types.tokens
- The tokens to represent in the list.- Returns:
- A list of the loadable annotations.
-
getValue
Returns a value of this annotation.- Parameters:
property
- The property being accessed.- Returns:
- The value for the supplied property.
-
getAnnotationType
Returns a description of the annotation type of this annotation.- Returns:
- A description of the annotation type of this annotation.
-
prepare
public <T extends Annotation> TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.Loadable<T> prepare(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.
-