Skip to content

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 finished
  • constPool: 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 on
Returns: the annotation builder the array was started from

putAnnotation ​

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 ​

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 ​

Appends a boolean value to the array.

Parameters:

  • value: the value to add
Returns: self for chaining

putByte ​

Appends a byte value to the array.

Parameters:

  • value: the byte value to append
Returns: this array builder

putChar ​

Appends a character value to the array.

Parameters:

  • value: the character value to append
Returns: this array builder

putClass ​

Appends a class value to the array.

Parameters:

  • value: the class to add
Returns: this array builder

putDouble ​

Appends a double value to the array.

Parameters:

  • value: the double value to append
Returns: this array builder

putEnum ​

Appends an enum constant to the array.

Parameters:

  • value: the constant to add
Returns: this array builder

putFloat ​

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 ​

Appends an integer value to the array.

Parameters:

  • value: the integer value to append
Returns: this array builder

putLong ​

Appends a long value to the array.

Parameters:

  • value: the long value to append
Returns: this array builder

putShort ​

Appends a short value to the array.

Parameters:

  • value: the short value to append
Returns: this array builder

putString ​

Appends a string value to the array.

Parameters:

  • value: the value to add
Returns: self for chaining