ClassBuilder.AnnotationBuilder
com.jsmacrosce.jsmacros.core.library.impl.classes.ClassBuilder.AnnotationBuilder
Builds values for an annotation created by an addAnnotation method. Each value is set by annotation-member name; finish() attaches the annotation and returns the member builder that created this one.
js
builder.addAnnotation(Reflection.getClass("java.lang.SuppressWarnings"))
.putArray("value")
.putString("unchecked")
.putString("rawtypes")
.finish()
.finish();Type Parameters
T: the builder returned by finish()
Nested type declared in ClassBuilder.
Nested types
Methods
finish
finish(): T#Adds this annotation to its target and returns the builder for that target.
// an annotation with nothing on it, which is all a marker needs
builder.addAnnotation(Reflection.getClass("java.lang.FunctionalInterface") as any)
.finish();Returns: the member the annotation was started from, which is the class builder, a field builder or a method builder
putAnnotation
putAnnotation(String key, Class<?> annotationClass): ClassBuilder.AnnotationBuilder<ClassBuilder.AnnotationBuilder<T>>#Starts building a nested annotation value. Finish the returned builder, then this builder to commit the outer annotation. For an array-valued member, use putArray(String) followed by AnnotationArrayBuilder.putAnnotation(Class).
Parameters:
key: the name of the annotation memberannotationClass: the annotation type to put on it
Returns: a builder for the inner annotation, whose finish hands back this builder
putArray
putArray(String key): ClassBuilder.AnnotationBuilder.AnnotationArrayBuilder<ClassBuilder.AnnotationBuilder<T>>#Starts an array-valued annotation member. Finish the returned array builder, then this annotation builder to commit the annotation.
builder.addAnnotation(Reflection.getClass("java.lang.SuppressWarnings") as any)
.putArray("value")
.putString("unchecked")
.putString("rawtypes")
.finish()
.finish();Parameters:
key: the name of the annotation member, which is declared as an array
Returns: a builder for the array, whose finish hands back this builder
putBoolean
putBoolean(String key, boolean value): ClassBuilder.AnnotationBuilder<T>#Sets a boolean-valued annotation member, replacing any previous value for that name.
Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putByte
putByte(String key, byte value): ClassBuilder.AnnotationBuilder<T>#Sets a byte-valued annotation member, replacing any previous value for that name.
Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putChar
putChar(String key, char value): ClassBuilder.AnnotationBuilder<T>#Sets a
char-valued annotation member, replacing any previous value for that name.Parameters:
key: the name of the annotation membervalue: the character to put on it
Returns: self for chaining
putClass
putClass(String key, Class<?> value): ClassBuilder.AnnotationBuilder<T>#Sets a
Class-valued annotation member using the class value rather than a class name string. For a string-valued member, use putString(String, String).Parameters:
key: the name of the annotation membervalue: the class to put on it
Returns: self for chaining
putDouble
putDouble(String key, double value): ClassBuilder.AnnotationBuilder<T>#Sets a
double annotation member.Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putEnum
putEnum(String key, Enum<?> value): ClassBuilder.AnnotationBuilder<T>#Sets an enum-valued annotation member from an enum constant. The member must accept that enum type; class-valued members use putClass(String, Class) instead.
Parameters:
key: the name of the annotation membervalue: the constant to put on it
Returns: self for chaining
putFloat
putFloat(String key, double value): ClassBuilder.AnnotationBuilder<T>#Sets a
float-valued annotation member, narrowing value to a float.Parameters:
key: the name of the annotation membervalue: the value to put on it, narrowed to a float
Returns: self for chaining
putInt
putInt(String key, int value): ClassBuilder.AnnotationBuilder<T>#Sets an
int-valued annotation member, replacing any previous value for that name.Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putLong
putLong(String key, long value): ClassBuilder.AnnotationBuilder<T>#Sets a
long-valued annotation member, replacing any previous value for that name.Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putShort
putShort(String key, short value): ClassBuilder.AnnotationBuilder<T>#Sets a
short-valued annotation member, replacing any previous value for that name.Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining
putString
putString(String key, String value): ClassBuilder.AnnotationBuilder<T>#Sets a string-valued annotation member, replacing any previous value for that name.
Parameters:
key: the name of the annotation membervalue: the value to put on it
Returns: self for chaining