public interface AnnotationBuilder
of(Class)
or of(ClassInfo)
;value()
and member()
methods to define annotation members;build()
to create an AnnotationInfo
.
Note that values of all members of given annotation type must be defined before
calling build()
, except of annotation members that declare a default value.
If a value is not defined for an annotation member that does not have a default value,
build()
will throw an exception.
Defining values of members that do not exist on given annotation type is possible,
and such members will be retained in the resulting AnnotationInfo
. However,
if that AnnotationInfo
is later transformed to an instance of the annotation
type, the non-existing members will disappear.
Modifier and Type | Method and Description |
---|---|
AnnotationInfo |
build()
Returns an
AnnotationInfo that includes all annotation members defined by previous method calls
on this builder. |
AnnotationBuilder |
member(java.lang.String name,
java.lang.annotation.Annotation value)
Adds an annotation-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.annotation.Annotation[] values)
Adds an annotation array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
AnnotationInfo value)
Adds an annotation-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
AnnotationInfo[] values)
Adds an annotation array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
AnnotationMember value)
Adds an annotation member with given
name , whose value is given value . |
AnnotationBuilder |
member(java.lang.String name,
boolean value)
Adds a boolean-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
boolean[] values)
Adds a boolean array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
byte value)
Adds a byte-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
byte[] values)
Adds a byte array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
char value)
Adds a char-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
char[] values)
Adds a char array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Class<?> value)
Adds a class-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Class<?>[] values)
Adds a class array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Class<? extends java.lang.Enum<?>> enumType,
java.lang.String enumValue)
Adds an enum-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Class<? extends java.lang.Enum<?>> enumType,
java.lang.String[] enumValues)
Adds an enum array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
ClassInfo value)
Adds a class-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
ClassInfo[] values)
Adds a class array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
ClassInfo enumType,
java.lang.String enumValue)
Adds an enum-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
ClassInfo enumType,
java.lang.String[] enumValues)
Adds an enum array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
double value)
Adds a double-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
double[] values)
Adds a double array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Enum<?> value)
Adds an enum-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.Enum<?>[] values)
Adds an enum array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
float value)
Adds a float-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
float[] values)
Adds a float array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
int value)
Adds an int-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
int[] values)
Adds an int array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
long value)
Adds a long-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
long[] values)
Adds a long array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
short value)
Adds a short-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
short[] values)
Adds a short array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.String value)
Adds a String-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
java.lang.String[] values)
Adds a String array-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
Type value)
Adds a class-valued annotation member with given
name . |
AnnotationBuilder |
member(java.lang.String name,
Type[] values)
Adds a class array-valued annotation member with given
name . |
static AnnotationBuilder |
of(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns a new
AnnotationBuilder that builds an annotation of given type. |
static AnnotationBuilder |
of(ClassInfo annotationType)
Returns a new
AnnotationBuilder that builds an annotation of given type. |
default AnnotationBuilder |
value(java.lang.annotation.Annotation value)
Adds an annotation-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.annotation.Annotation[] values)
Adds an annotation array-valued annotation member called
value . |
default AnnotationBuilder |
value(AnnotationInfo value)
Adds an annotation-valued annotation member called
value . |
default AnnotationBuilder |
value(AnnotationInfo[] values)
Adds an annotation array-valued annotation member called
value . |
default AnnotationBuilder |
value(AnnotationMember value)
Adds an annotation member called
value , whose value is given value . |
default AnnotationBuilder |
value(boolean value)
Adds a boolean-valued annotation member called
value . |
default AnnotationBuilder |
value(boolean[] values)
Adds a boolean array-valued annotation member called
value . |
default AnnotationBuilder |
value(byte value)
Adds a byte-valued annotation member called
value . |
default AnnotationBuilder |
value(byte[] values)
Adds a byte array-valued annotation member called
value . |
default AnnotationBuilder |
value(char value)
Adds a char-valued annotation member called
value . |
default AnnotationBuilder |
value(char[] values)
Adds a char array-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Class<?> value)
Adds a class-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Class<?>[] values)
Adds a class array-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Class<? extends java.lang.Enum<?>> enumType,
java.lang.String enumValue)
Adds an enum-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Class<? extends java.lang.Enum<?>> enumType,
java.lang.String[] enumValues)
Adds an enum array-valued annotation member called
value . |
default AnnotationBuilder |
value(ClassInfo value)
Adds a class-valued annotation member called
value . |
default AnnotationBuilder |
value(ClassInfo[] values)
Adds a class array-valued annotation member called
value . |
default AnnotationBuilder |
value(ClassInfo enumType,
java.lang.String enumValue)
Adds an enum-valued annotation member called
value . |
default AnnotationBuilder |
value(ClassInfo enumType,
java.lang.String[] enumValues)
Adds an enum array-valued annotation member called
value . |
default AnnotationBuilder |
value(double value)
Adds a double-valued annotation member called
value . |
default AnnotationBuilder |
value(double[] values)
Adds a double array-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Enum<?> value)
Adds an enum-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.Enum<?>[] values)
Adds an enum array-valued annotation member called
value . |
default AnnotationBuilder |
value(float value)
Adds a float-valued annotation member called
value . |
default AnnotationBuilder |
value(float[] values)
Adds a float array-valued annotation member called
value . |
default AnnotationBuilder |
value(int value)
Adds an int-valued annotation member called
value . |
default AnnotationBuilder |
value(int[] values)
Adds an int array-valued annotation member called
value . |
default AnnotationBuilder |
value(long value)
Adds a long-valued annotation member called
value . |
default AnnotationBuilder |
value(long[] values)
Adds a long array-valued annotation member called
value . |
default AnnotationBuilder |
value(short value)
Adds a short-valued annotation member called
value . |
default AnnotationBuilder |
value(short[] values)
Adds a short array-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.String value)
Adds a String-valued annotation member called
value . |
default AnnotationBuilder |
value(java.lang.String[] values)
Adds a String array-valued annotation member called
value . |
default AnnotationBuilder |
value(Type value)
Adds a class-valued annotation member called
value . |
default AnnotationBuilder |
value(Type[] values)
Adds a class array-valued annotation member called
value . |
static AnnotationBuilder of(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
AnnotationBuilder
that builds an annotation of given type.annotationType
- the annotation type, must not be null
AnnotationBuilder
, never null
static AnnotationBuilder of(ClassInfo annotationType)
AnnotationBuilder
that builds an annotation of given type.annotationType
- the annotation type, must not be null
AnnotationBuilder
default AnnotationBuilder value(AnnotationMember value)
value
, whose value is given value
.value
- value of the annotation memberAnnotationBuilder
default AnnotationBuilder value(boolean value)
value
.value
- the boolean valueAnnotationBuilder
default AnnotationBuilder value(boolean[] values)
value
.values
- the boolean array, must not be null
AnnotationBuilder
default AnnotationBuilder value(byte value)
value
.value
- the byte valueAnnotationBuilder
default AnnotationBuilder value(byte[] values)
value
.values
- the byte array, must not be null
AnnotationBuilder
default AnnotationBuilder value(short value)
value
.value
- the short valueAnnotationBuilder
default AnnotationBuilder value(short[] values)
value
.values
- the short array, must not be null
AnnotationBuilder
default AnnotationBuilder value(int value)
value
.value
- the int valueAnnotationBuilder
default AnnotationBuilder value(int[] values)
value
.values
- the int array, must not be null
AnnotationBuilder
default AnnotationBuilder value(long value)
value
.value
- the long valueAnnotationBuilder
default AnnotationBuilder value(long[] values)
value
.values
- the long array, must not be null
AnnotationBuilder
default AnnotationBuilder value(float value)
value
.value
- the float valueAnnotationBuilder
default AnnotationBuilder value(float[] values)
value
.values
- the float array, must not be null
AnnotationBuilder
default AnnotationBuilder value(double value)
value
.value
- the double valueAnnotationBuilder
default AnnotationBuilder value(double[] values)
value
.values
- the double array, must not be null
AnnotationBuilder
default AnnotationBuilder value(char value)
value
.value
- the char valueAnnotationBuilder
default AnnotationBuilder value(char[] values)
value
.values
- the char array, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.String value)
value
.value
- the String value, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.String[] values)
value
.values
- the String array, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Enum<?> value)
value
.value
- the enum value, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Enum<?>[] values)
value
.values
- the enum array, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Class<? extends java.lang.Enum<?>> enumType, java.lang.String enumValue)
value
.enumType
- the enum type, must not be null
enumValue
- name of the enum constant, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Class<? extends java.lang.Enum<?>> enumType, java.lang.String[] enumValues)
value
.enumType
- the enum type, must not be null
enumValues
- names of the enum constants, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(ClassInfo enumType, java.lang.String enumValue)
value
.enumType
- the enum type, must not be null
enumValue
- name of the enum constant, must not be null
AnnotationBuilder
default AnnotationBuilder value(ClassInfo enumType, java.lang.String[] enumValues)
value
.enumType
- the enum type, must not be null
enumValues
- names of the enum constants, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Class<?> value)
value
.value
- the class value, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.Class<?>[] values)
value
.values
- the class array, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(ClassInfo value)
value
.value
- the class value, must not be null
AnnotationBuilder
default AnnotationBuilder value(ClassInfo[] values)
value
.values
- the class array, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(Type value)
value
.
The value
parameter may only be:
VoidType
;PrimitiveType
;ClassType
;ArrayType
whose element type is either PrimitiveType
or ClassType
.value
- the class value, must not be null
AnnotationBuilder
java.lang.IllegalArgumentException
- if given type is invalid, as described abovedefault AnnotationBuilder value(Type[] values)
value
.
The values
parameter may only contain:
VoidType
;PrimitiveType
;ClassType
;ArrayType
whose element type is either PrimitiveType
or ClassType
.values
- the class array, must not be null
or contain null
AnnotationBuilder
java.lang.IllegalArgumentException
- if any given type is invalid, as described abovedefault AnnotationBuilder value(AnnotationInfo value)
value
.value
- the annotation value, must not be null
AnnotationBuilder
default AnnotationBuilder value(AnnotationInfo[] values)
value
.values
- the annotation array, must not be null
or contain null
AnnotationBuilder
default AnnotationBuilder value(java.lang.annotation.Annotation value)
value
.value
- the annotation value, must not be null
AnnotationBuilder
default AnnotationBuilder value(java.lang.annotation.Annotation[] values)
value
.values
- the annotation array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, AnnotationMember value)
name
, whose value is given value
.name
- name of the annotation member, must not be null
value
- value of the annotation member, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, boolean value)
name
.name
- the member name, must not be null
value
- the boolean valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, boolean[] values)
name
.name
- the member name, must not be null
values
- the boolean array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, byte value)
name
.name
- the member name, must not be null
value
- the byte valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, byte[] values)
name
.name
- the member name, must not be null
values
- the byte array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, short value)
name
.name
- the member name, must not be null
value
- the short valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, short[] values)
name
.name
- the member name, must not be null
values
- the short array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, int value)
name
.name
- the member name, must not be null
value
- the int valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, int[] values)
name
.name
- the member name, must not be null
values
- the int array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, long value)
name
.name
- the member name, must not be null
value
- the long valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, long[] values)
name
.name
- the member name, must not be null
values
- the long array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, float value)
name
.name
- the member name, must not be null
value
- the float valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, float[] values)
name
.name
- the member name, must not be null
values
- the float array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, double value)
name
.name
- the member name, must not be null
value
- the double valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, double[] values)
name
.name
- the member name, must not be null
values
- the double array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, char value)
name
.name
- the member name, must not be null
value
- the char valueAnnotationBuilder
AnnotationBuilder member(java.lang.String name, char[] values)
name
.name
- the member name, must not be null
values
- the char array, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.String value)
name
.name
- the member name, must not be null
value
- the String value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.String[] values)
name
.name
- the member name, must not be null
values
- the String array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Enum<?> value)
name
.name
- the member name, must not be null
value
- the enum value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Enum<?>[] values)
name
.name
- the member name, must not be null
values
- the enum array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Class<? extends java.lang.Enum<?>> enumType, java.lang.String enumValue)
name
.name
- the member name, must not be null
enumType
- the enum type, must not be null
enumValue
- name of the enum constant, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Class<? extends java.lang.Enum<?>> enumType, java.lang.String[] enumValues)
name
.name
- the member name, must not be null
enumType
- the enum type, must not be null
enumValues
- names of the enum constants, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, ClassInfo enumType, java.lang.String enumValue)
name
.name
- the member name, must not be null
enumType
- the enum type, must not be null
enumValue
- name of the enum constant, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, ClassInfo enumType, java.lang.String[] enumValues)
name
.name
- the member name, must not be null
enumType
- the enum type, must not be null
enumValues
- names of the enum constants, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Class<?> value)
name
.name
- the member name, must not be null
value
- the class value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.Class<?>[] values)
name
.name
- the member name, must not be null
values
- the class array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, ClassInfo value)
name
.name
- the member name, must not be null
value
- the class value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, ClassInfo[] values)
name
.name
- the member name, must not be null
values
- the class array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, Type value)
name
.
The value
parameter may only be:
VoidType
;PrimitiveType
;ClassType
;ArrayType
whose element type is either PrimitiveType
or ClassType
.name
- the member name, must not be null
value
- the class value, must not be null
AnnotationBuilder
java.lang.IllegalArgumentException
- if given type is invalid, as described aboveAnnotationBuilder member(java.lang.String name, Type[] values)
name
.
The values
parameter may only include:
VoidType
;PrimitiveType
;ClassType
;ArrayType
whose element type is either PrimitiveType
or ClassType
.name
- the member name, must not be null
values
- the class array, must not be null
or contain null
AnnotationBuilder
java.lang.IllegalArgumentException
- if any given type is invalid, as described aboveAnnotationBuilder member(java.lang.String name, AnnotationInfo value)
name
.name
- the member name, must not be null
value
- the annotation value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, AnnotationInfo[] values)
name
.name
- the member name, must not be null
values
- the annotation array, must not be null
or contain null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.annotation.Annotation value)
name
.name
- the member name, must not be null
value
- the annotation value, must not be null
AnnotationBuilder
AnnotationBuilder member(java.lang.String name, java.lang.annotation.Annotation[] values)
name
.name
- the member name, must not be null
values
- the annotation array, must not be null
or contain null
AnnotationBuilder
AnnotationInfo build()
AnnotationInfo
that includes all annotation members defined by previous method calls
on this builder. After build()
is called, this builder instance should be discarded.AnnotationInfo
, never null
java.lang.IllegalStateException
- if a value of some annotation member was not set, and that member
does not declare a default value