ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder
com.jsmacrosce.jsmacros.core.library.impl.classes.ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder
Builds an annotation array in insertion order. AnnotationBuilder.putArray(String) returns this builder; call finish() to set the accumulated values and return to the parent builder.
Type Parameters
U: the parent builder returned by finish()
Nested type declared in ClassBuilder.AnnotationBuilder.
Constructors
new ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder
new ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder(ClassBuilder.AnnotationBuilder<T> annotationBuilder, U parent, ConstPool constPool)#Creates an empty annotation-array builder.
Parameters:
parent: the annotation builder to hand back when the array is finishedconstPool: the pool the values are written into
Methods
finish
finish(): U#Writes the accumulated values into this array and returns its parent builder. For an annotation member, finish the returned annotation builder separately to commit the annotation.
builder.addAnnotation(Reflection.getClass("java.lang.SuppressWarnings") as any)
.putArray("value")
.putString("unchecked")
.putString("rawtypes")
.finish() // closes the array
.finish(); // and now puts the annotation onReturns: the annotation builder the array was started from
putAnnotation
putAnnotation(Class<?> annotationClass): ClassBuilder.AnnotationBuilder<ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>>#Starts building an annotation value and appends it to the array. The returned annotation builder's
finish returns this array builder.Parameters:
annotationClass: the annotation type to add
Returns: a builder for the annotation; finishing it returns this array builder
putArray
putArray(Class<?> annotationClass): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>>#Starts a nested annotation-value array and adds it to this array. The argument is ignored; the inner array's element values are determined by its
put calls. Finish the inner builder, then this builder, to commit both arrays.Parameters:
annotationClass: ignored
Returns: a builder for the inner array, whose finish hands back this array builder
putBoolean
putBoolean(boolean value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a boolean value to the array.
Parameters:
value: the value to add
Returns: self for chaining
putByte
putByte(byte value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a byte value to the array.
Parameters:
value: the byte value to append
Returns: this array builder
putChar
putChar(char value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a character value to the array.
Parameters:
value: the character value to append
Returns: this array builder
putClass
putClass(Class<?> value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a class value to the array.
Parameters:
value: the class to add
Returns: this array builder
putDouble
putDouble(double value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a double value to the array.
Parameters:
value: the double value to append
Returns: this array builder
putEnum
putEnum(Enum<?> value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends an enum constant to the array.
Parameters:
value: the constant to add
Returns: this array builder
putFloat
putFloat(double value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a float value, converting the input from
double to float.Parameters:
value: the value to convert to a float
Returns: this array builder
putInt
putInt(int value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends an integer value to the array.
Parameters:
value: the integer value to append
Returns: this array builder
putLong
putLong(long value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a long value to the array.
Parameters:
value: the long value to append
Returns: this array builder
putShort
putShort(short value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a short value to the array.
Parameters:
value: the short value to append
Returns: this array builder
putString
putString(String value): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<U>#Appends a string value to the array.
Parameters:
value: the value to add
Returns: self for chaining