Class Field.Builder
java.lang.Object
be.imgn.gaia.processing.source.Field.Builder
- Enclosing class:
Field
-
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation(Annotation annotation) Adds a declaration annotation.addAnnotation(ClassName annotation) Adds an annotation without members.addAnnotation(Class<? extends Annotation> annotation) Adds a declaration annotation without members.addAnnotations(Iterable<Annotation> more) Adds annotations.addJavadoc(CodeBlock text) Adds Javadoc text.addJavadoc(String format, @Nullable Object... args) Adds Javadoc text.addModifiers(Modifier... more) Adds modifiers.build()Builds the field.initializer(CodeBlock expression) Sets the initializer.initializer(String format, @Nullable Object... args) Sets the initializer.
-
Method Details
-
addModifiers
Adds modifiers.- Parameters:
more- the modifiers- Returns:
- this builder
- Throws:
IllegalArgumentException- if a modifier is not allowed on a field, is repeated, or conflicts with another one, such aspublicwithprivateorfinalwithvolatile
-
addAnnotation
Adds a declaration annotation. A type annotation, such as@Nullable, goes on the type instead.- Parameters:
annotation- the annotation- Returns:
- this builder
-
addAnnotation
Adds a declaration annotation without members.- Parameters:
annotation- the annotation type- Returns:
- this builder
- Throws:
IllegalArgumentException- if the class is not an annotation type
-
addAnnotation
Adds an annotation without members.- Parameters:
annotation- the annotation type- Returns:
- this builder
-
addAnnotations
Adds annotations.- Parameters:
more- the annotations- Returns:
- this builder
-
addJavadoc
Adds Javadoc text. End each line with\n.- Parameters:
format- the text, with placeholdersargs- the arguments of the placeholders- Returns:
- this builder
- Throws:
IllegalArgumentException- if the format and the arguments do not match
-
addJavadoc
Adds Javadoc text. End each line with\n.- Parameters:
text- the text- Returns:
- this builder
-
initializer
Sets the initializer.- Parameters:
format- the expression after=, with placeholdersargs- the arguments of the placeholders- Returns:
- this builder
- Throws:
IllegalArgumentException- if the format and the arguments do not match, or the initializer is not balancedIllegalStateException- if the initializer is already set
-
initializer
Sets the initializer.- Parameters:
expression- the expression after=- Returns:
- this builder
- Throws:
IllegalArgumentException- if the expression is not balancedIllegalStateException- if the initializer is already set
-
build
Builds the field.- Returns:
- the field
- Throws:
IllegalStateException- if the Javadoc is not balanced
-