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 TypeDescriptionThe annotation type.private final Map<String, AnnotationValue<?, ?>> A mapping of annotation properties to their annotation values. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder(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 additionalbooleanproperty.Returns a builder with the additionalbyteproperty.Returns a builder with the additionalcharproperty.Returns a builder with the additionaldoubleproperty.Returns a builder with the additionalfloatproperty.Returns a builder with the additionalintproperty.Returns a builder with the additionallongproperty.Returns a builder with the additionalshortproperty.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 additionalStringproperty.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 additionalbooleanarray property.defineArray(String property, byte... value) Returns a builder with the additionalbytearray property.defineArray(String property, char... value) Returns a builder with the additionalchararray property.defineArray(String property, double... value) Returns a builder with the additionaldoublearray property.defineArray(String property, float... value) Returns a builder with the additionalfloatarray property.defineArray(String property, int... value) Returns a builder with the additionalintarray property.defineArray(String property, long... value) Returns a builder with the additionallongarray property.defineArray(String property, short... value) Returns a builder with the additionalshortarray property.defineArray(String property, String... value) Returns a builder with the additionalStringarray 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 additionalbooleanproperty.- Parameters:
property- The name of the property to define.value- Thebooleanvalue to define for the property.- Returns:
- A builder with the additional
booleanproperty.
-
define
Returns a builder with the additionalbyteproperty.- Parameters:
property- The name of the property to define.value- Thebytevalue to define for the property.- Returns:
- A builder with the additional
byteproperty.
-
define
Returns a builder with the additionalcharproperty.- Parameters:
property- The name of the property to define.value- Thecharvalue to define for the property.- Returns:
- A builder with the additional
charproperty.
-
define
Returns a builder with the additionalshortproperty.- Parameters:
property- The name of the property to define.value- Theshortvalue to define for the property.- Returns:
- A builder with the additional
shortproperty.
-
define
Returns a builder with the additionalintproperty.- Parameters:
property- The name of the property to define.value- Theintvalue to define for the property.- Returns:
- A builder with the additional
intproperty.
-
define
Returns a builder with the additionallongproperty.- Parameters:
property- The name of the property to define.value- Thelongvalue to define for the property.- Returns:
- A builder with the additional
longproperty.
-
define
Returns a builder with the additionalfloatproperty.- Parameters:
property- The name of the property to define.value- Thefloatvalue to define for the property.- Returns:
- A builder with the additional
floatproperty.
-
define
Returns a builder with the additionaldoubleproperty.- Parameters:
property- The name of the property to define.value- Thedoublevalue to define for the property.- Returns:
- A builder with the additional
doubleproperty.
-
define
Returns a builder with the additionalStringproperty. -
defineArray
Returns a builder with the additionalbooleanarray property.- Parameters:
property- The name of the property to define.value- Thebooleanvalues to define for the property.- Returns:
- A builder with the additional
booleanarray property.
-
defineArray
Returns a builder with the additionalbytearray property.- Parameters:
property- The name of the property to define.value- Thebytevalues to define for the property.- Returns:
- A builder with the additional
bytearray property.
-
defineArray
Returns a builder with the additionalchararray property.- Parameters:
property- The name of the property to define.value- Thecharvalues to define for the property.- Returns:
- A builder with the additional
chararray property.
-
defineArray
Returns a builder with the additionalshortarray property.- Parameters:
property- The name of the property to define.value- Theshortvalues to define for the property.- Returns:
- A builder with the additional
shortarray property.
-
defineArray
Returns a builder with the additionalintarray property.- Parameters:
property- The name of the property to define.value- Theintvalues to define for the property.- Returns:
- A builder with the additional
intarray property.
-
defineArray
Returns a builder with the additionallongarray property.- Parameters:
property- The name of the property to define.value- Thelongvalues to define for the property.- Returns:
- A builder with the additional
longarray property.
-
defineArray
Returns a builder with the additionalfloatarray property.- Parameters:
property- The name of the property to define.value- Thefloatvalues to define for the property.- Returns:
- A builder with the additional
floatarray property.
-
defineArray
Returns a builder with the additionaldoublearray property.- Parameters:
property- The name of the property to define.value- Thedoublevalues to define for the property.- Returns:
- A builder with the additional
doublearray property.
-
defineArray
Returns a builder with the additionalStringarray 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-trueif the annotation description should be validated for having included all values.- Returns:
- An appropriate annotation description.
-