Class AnnotationDescription.Builder
java.lang.Object
net.bytebuddy.description.annotation.AnnotationDescription.Builder
- Enclosing interface:
AnnotationDescription
A builder for pragmatically creating
AnnotationDescription
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeDescription
The annotation type.private final Map
<String, AnnotationValue<?, ?>> A mapping of annotation properties to their annotation values. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Builder
(TypeDescription annotationType, Map<String, AnnotationValue<?, ?>> annotationValues) Creates a builder for an annotation description. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates an annotation description for the values that were defined for this builder.build
(boolean validated) Creates an annotation description for the values that were defined for this builder.Returns a builder with the additionalboolean
property.Returns a builder with the additionalbyte
property.Returns a builder with the additionalchar
property.Returns a builder with the additionaldouble
property.Returns a builder with the additionalfloat
property.Returns a builder with the additionalint
property.Returns a builder with the additionallong
property.Returns a builder with the additionalshort
property.define
(String property, Annotation annotation) Returns a builder with the additional annotation property.Returns a builder with the additional class property.Returns a builder with the additional enumeration property.Returns a builder with the additionalString
property.define
(String property, AnnotationDescription annotationDescription) Returns a builder with the additional annotation property.define
(String property, AnnotationValue<?, ?> value) Returns a builder with the additional, given property.define
(String property, EnumerationDescription value) Returns a builder with the additional enumeration property.define
(String property, TypeDescription typeDescription) Returns a builder with the additional class property.define
(String property, TypeDescription enumerationType, String value) Returns a builder with the additional enumeration property.<T extends Annotation>
AnnotationDescription.BuilderdefineAnnotationArray
(String property, Class<T> annotationType, T... annotation) Returns a builder with the additional annotation array property.defineAnnotationArray
(String property, TypeDescription annotationType, AnnotationDescription... annotationDescription) Returns a builder with the additional annotation array property.defineArray
(String property, boolean... value) Returns a builder with the additionalboolean
array property.defineArray
(String property, byte... value) Returns a builder with the additionalbyte
array property.defineArray
(String property, char... value) Returns a builder with the additionalchar
array property.defineArray
(String property, double... value) Returns a builder with the additionaldouble
array property.defineArray
(String property, float... value) Returns a builder with the additionalfloat
array property.defineArray
(String property, int... value) Returns a builder with the additionalint
array property.defineArray
(String property, long... value) Returns a builder with the additionallong
array property.defineArray
(String property, short... value) Returns a builder with the additionalshort
array property.defineArray
(String property, String... value) Returns a builder with the additionalString
array property.<T extends Enum<?>>
AnnotationDescription.BuilderdefineEnumerationArray
(String property, Class<T> enumerationType, T... value) Returns a builder with the additional enumeration array property.defineEnumerationArray
(String property, TypeDescription enumerationType, String... value) Returns a builder with the additional enumeration array property.defineEnumerationArray
(String property, TypeDescription enumerationType, EnumerationDescription... value) Returns a builder with the additional enumeration array property.defineTypeArray
(String property, Class<?>... type) Returns a builder with the additional type array property.defineTypeArray
(String property, TypeDescription... typeDescription) Returns a builder with the additional type array property.ofType
(Class<? extends Annotation> annotationType) Creates a builder for creating an annotation of the given type.ofType
(TypeDescription annotationType) Creates a builder for creating an annotation of the given type.
-
Field Details
-
annotationType
The annotation type. -
annotationValues
A mapping of annotation properties to their annotation values.
-
-
Constructor Details
-
Builder
protected Builder(TypeDescription annotationType, Map<String, AnnotationValue<?, ?>> annotationValues) Creates a builder for an annotation description.- Parameters:
annotationType
- The annotation type.annotationValues
- A mapping of annotation properties to their annotation values.
-
-
Method Details
-
ofType
Creates a builder for creating an annotation of the given type.- Parameters:
annotationType
- The annotation type.- Returns:
- A builder for creating an annotation of the given type.
-
ofType
Creates a builder for creating an annotation of the given type.- Parameters:
annotationType
- A description of the annotation type.- Returns:
- A builder for creating an annotation of the given type.
-
define
Returns a builder with the additional, given property.- Parameters:
property
- The name of the property to define.value
- An explicit description of the annotation value.- Returns:
- A builder with the additional, given property.
-
define
Returns a builder with the additional enumeration property.- Parameters:
property
- The name of the property to define.value
- The enumeration value to define.- Returns:
- A builder with the additional enumeration property.
-
define
public AnnotationDescription.Builder define(String property, TypeDescription enumerationType, String value) Returns a builder with the additional enumeration property.- Parameters:
property
- The name of the property to define.enumerationType
- The type of the enumeration.value
- The enumeration value to define.- Returns:
- A builder with the additional enumeration property.
-
define
Returns a builder with the additional enumeration property.- Parameters:
property
- The name of the property to define.value
- A description of the enumeration value to define.- Returns:
- A builder with the additional enumeration property.
-
define
Returns a builder with the additional annotation property.- Parameters:
property
- The name of the property to define.annotation
- The annotation value to define.- Returns:
- A builder with the additional annotation property.
-
define
public AnnotationDescription.Builder define(String property, AnnotationDescription annotationDescription) Returns a builder with the additional annotation property.- Parameters:
property
- The name of the property to define.annotationDescription
- A description of the annotation value to define.- Returns:
- A builder with the additional annotation property.
-
define
Returns a builder with the additional class property.- Parameters:
property
- The name of the property to define.type
- The class value to define.- Returns:
- A builder with the additional class property.
-
define
Returns a builder with the additional class property.- Parameters:
property
- The name of the property to define.typeDescription
- A description of the type to define as a property value.- Returns:
- A builder with the additional class property.
-
defineEnumerationArray
public <T extends Enum<?>> AnnotationDescription.Builder defineEnumerationArray(String property, Class<T> enumerationType, T... value) Returns a builder with the additional enumeration array property.- Type Parameters:
T
- The enumeration type.- Parameters:
property
- The name of the property to define.enumerationType
- The type of the enumeration, i.e. the component type of the enumeration array.value
- The enumeration values to be contained by the array.- Returns:
- A builder with the additional class property.
-
defineEnumerationArray
public AnnotationDescription.Builder defineEnumerationArray(String property, TypeDescription enumerationType, String... value) Returns a builder with the additional enumeration array property.- Parameters:
property
- The name of the property to define.enumerationType
- The type of the enumerations, i.e. is the component type of the enumeration array.value
- The enumeration values to be contained by the array.- Returns:
- A builder with the additional enumeration property.
-
defineEnumerationArray
public AnnotationDescription.Builder defineEnumerationArray(String property, TypeDescription enumerationType, EnumerationDescription... value) Returns a builder with the additional enumeration array property.- Parameters:
property
- The name of the property to define.enumerationType
- The type of the enumerations, i.e. the component type of the enumeration array.value
- Descriptions of the enumerations to be contained by the array.- Returns:
- A builder with the additional enumeration property.
-
defineAnnotationArray
public <T extends Annotation> AnnotationDescription.Builder defineAnnotationArray(String property, Class<T> annotationType, T... annotation) Returns a builder with the additional annotation array property.- Type Parameters:
T
- The annotation type.- Parameters:
property
- The name of the property to define.annotationType
- The type of the annotations, i.e. the component type of the enumeration array.annotation
- The annotation values to be contained by the array.- Returns:
- A builder with the additional annotation property.
-
defineAnnotationArray
public AnnotationDescription.Builder defineAnnotationArray(String property, TypeDescription annotationType, AnnotationDescription... annotationDescription) Returns a builder with the additional annotation array property.- Parameters:
property
- The name of the property to define.annotationType
- The type of the annotations, i.e. the component type of the enumeration array.annotationDescription
- Descriptions of the annotation values to be contained by the array.- Returns:
- A builder with the additional annotation property.
-
defineTypeArray
Returns a builder with the additional type array property.- Parameters:
property
- The name of the property to define.type
- The types that should be contained by the array.- Returns:
- A builder with the additional type array property.
-
defineTypeArray
public AnnotationDescription.Builder defineTypeArray(String property, TypeDescription... typeDescription) Returns a builder with the additional type array property.- Parameters:
property
- The name of the property to define.typeDescription
- Descriptions of the types that should be contained by the array.- Returns:
- A builder with the additional type array property.
-
define
Returns a builder with the additionalboolean
property.- Parameters:
property
- The name of the property to define.value
- Theboolean
value to define for the property.- Returns:
- A builder with the additional
boolean
property.
-
define
Returns a builder with the additionalbyte
property.- Parameters:
property
- The name of the property to define.value
- Thebyte
value to define for the property.- Returns:
- A builder with the additional
byte
property.
-
define
Returns a builder with the additionalchar
property.- Parameters:
property
- The name of the property to define.value
- Thechar
value to define for the property.- Returns:
- A builder with the additional
char
property.
-
define
Returns a builder with the additionalshort
property.- Parameters:
property
- The name of the property to define.value
- Theshort
value to define for the property.- Returns:
- A builder with the additional
short
property.
-
define
Returns a builder with the additionalint
property.- Parameters:
property
- The name of the property to define.value
- Theint
value to define for the property.- Returns:
- A builder with the additional
int
property.
-
define
Returns a builder with the additionallong
property.- Parameters:
property
- The name of the property to define.value
- Thelong
value to define for the property.- Returns:
- A builder with the additional
long
property.
-
define
Returns a builder with the additionalfloat
property.- Parameters:
property
- The name of the property to define.value
- Thefloat
value to define for the property.- Returns:
- A builder with the additional
float
property.
-
define
Returns a builder with the additionaldouble
property.- Parameters:
property
- The name of the property to define.value
- Thedouble
value to define for the property.- Returns:
- A builder with the additional
double
property.
-
define
Returns a builder with the additionalString
property. -
defineArray
Returns a builder with the additionalboolean
array property.- Parameters:
property
- The name of the property to define.value
- Theboolean
values to define for the property.- Returns:
- A builder with the additional
boolean
array property.
-
defineArray
Returns a builder with the additionalbyte
array property.- Parameters:
property
- The name of the property to define.value
- Thebyte
values to define for the property.- Returns:
- A builder with the additional
byte
array property.
-
defineArray
Returns a builder with the additionalchar
array property.- Parameters:
property
- The name of the property to define.value
- Thechar
values to define for the property.- Returns:
- A builder with the additional
char
array property.
-
defineArray
Returns a builder with the additionalshort
array property.- Parameters:
property
- The name of the property to define.value
- Theshort
values to define for the property.- Returns:
- A builder with the additional
short
array property.
-
defineArray
Returns a builder with the additionalint
array property.- Parameters:
property
- The name of the property to define.value
- Theint
values to define for the property.- Returns:
- A builder with the additional
int
array property.
-
defineArray
Returns a builder with the additionallong
array property.- Parameters:
property
- The name of the property to define.value
- Thelong
values to define for the property.- Returns:
- A builder with the additional
long
array property.
-
defineArray
Returns a builder with the additionalfloat
array property.- Parameters:
property
- The name of the property to define.value
- Thefloat
values to define for the property.- Returns:
- A builder with the additional
float
array property.
-
defineArray
Returns a builder with the additionaldouble
array property.- Parameters:
property
- The name of the property to define.value
- Thedouble
values to define for the property.- Returns:
- A builder with the additional
double
array property.
-
defineArray
Returns a builder with the additionalString
array property. -
build
Creates an annotation description for the values that were defined for this builder. It is validated that all properties are defined if no default value is set for an annotation property.- Returns:
- An appropriate annotation description.
-
build
Creates an annotation description for the values that were defined for this builder.- Parameters:
validated
-true
if the annotation description should be validated for having included all values.- Returns:
- An appropriate annotation description.
-