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 Classes Modifier and Type Class Description private static class
TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.Loadable<S extends java.lang.annotation.Annotation>
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 java.lang.annotation.Annotation>, AnnotationDescription.Builder, AnnotationDescription.ForLoadedAnnotation<S extends java.lang.annotation.Annotation>, AnnotationDescription.Latent, AnnotationDescription.RenderingDispatcher
-
-
Field Summary
Fields Modifier and Type Field Description private TypeDescription
annotationType
The type of this annotation.protected TypePool
typePool
The type pool for looking up type references.protected java.util.Map<java.lang.String,AnnotationValue<?,?>>
values
A map of annotation values by their property name.-
Fields inherited from interface net.bytebuddy.description.annotation.AnnotationDescription
UNDEFINED
-
-
Constructor Summary
Constructors Modifier Constructor Description private
LazyAnnotationDescription(TypePool typePool, TypeDescription annotationType, java.util.Map<java.lang.String,AnnotationValue<?,?>> values)
Creates a new lazy annotation description.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static AnnotationList
asList(TypePool typePool, java.util.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, java.util.List<? extends TypePool.Default.LazyTypeDescription.AnnotationToken> tokens)
Represents a list of annotation tokens in form of a list of lazy type annotations.TypeDescription
getAnnotationType()
Returns a description of the annotation type of this annotation.AnnotationValue<?,?>
getValue(MethodDescription.InDefinedShape property)
Returns the value of this annotation.<T extends java.lang.annotation.Annotation>
TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.Loadable<T>prepare(java.lang.Class<T> annotationType)
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, hashCode, isDocumented, isInherited, toString
-
-
-
-
Field Detail
-
typePool
protected final TypePool typePool
The type pool for looking up type references.
-
annotationType
private final TypeDescription annotationType
The type of this annotation.
-
values
protected final java.util.Map<java.lang.String,AnnotationValue<?,?>> values
A map of annotation values by their property name.
-
-
Constructor Detail
-
LazyAnnotationDescription
private LazyAnnotationDescription(TypePool typePool, TypeDescription annotationType, java.util.Map<java.lang.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 Detail
-
asListOfNullable
protected static AnnotationList asListOfNullable(TypePool typePool, java.util.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, java.util.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
public AnnotationValue<?,?> getValue(MethodDescription.InDefinedShape property)
Returns the value of this annotation.- Parameters:
property
- The property being accessed.- Returns:
- The value for the supplied property.
-
getAnnotationType
public TypeDescription 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 java.lang.annotation.Annotation> TypePool.Default.LazyTypeDescription.LazyAnnotationDescription.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.
-
-