Package com.github.tadukoo.java
Class JavaFieldBuilder<FieldType extends JavaField>
java.lang.Object
com.github.tadukoo.java.JavaFieldBuilder<FieldType>
- Direct Known Subclasses:
EditableJavaField.EditableJavaFieldBuilder,UneditableJavaField.UneditableJavaFieldBuilder
Java Field Builder is a builder to create a
JavaField. It has the following parameters:
| Parameter | Description | Default or Required |
|---|---|---|
| sectionComment | The section comment above the field | null |
| javadoc | The Javadoc on the field |
null |
| annotations | The annotations on the field |
An empty list |
| visibility | The Visibility of the field |
Visibility.PRIVATE |
| isStatic | If the field is static or not | false |
| isFinal | If the field is final or not | false |
| type | The type of the field | Required |
| name | The name of the field | Required |
| value | The value assigned to the field | null |
- Since:
- Alpha v.0.2 (within JavaField), Alpha v.0.4 (as separate)
- Version:
- Alpha v.0.4
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<JavaAnnotation>Theannotationson the fieldprotected booleanWhether the field is final or notprotected booleanWhether the field is static or notprotected JavadocTheJavadocon the fieldprotected StringThe name of the fieldprotected StringThe section comment above the fieldprotected StringThe type of the fieldprotected StringThe value assigned to the fieldprotected VisibilityTheVisibilityof the field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotation(JavaAnnotation annotation) annotations(List<JavaAnnotation> annotations) build()Checks for any errors in the current parameters, then builds a newJavaFieldChecks for errors specific to the subclassprotected abstract FieldTypeConstructs aJavaFieldusing the set parametersisFinal()Sets the field to be finalisFinal(boolean isFinal) isStatic()Sets the field to be staticisStatic(boolean isStatic) sectionComment(String sectionComment) visibility(Visibility visibility)
-
Field Details
-
sectionComment
The section comment above the field -
javadoc
TheJavadocon the field -
annotations
Theannotationson the field -
visibility
TheVisibilityof the field -
isStatic
protected boolean isStaticWhether the field is static or not -
isFinal
protected boolean isFinalWhether the field is final or not -
type
The type of the field -
name
The name of the field -
value
The value assigned to the field
-
-
Constructor Details
-
JavaFieldBuilder
protected JavaFieldBuilder()Constructs a new JavaFieldBuilder
-
-
Method Details
-
sectionComment
- Parameters:
sectionComment- The section comment above the field- Returns:
- this, to continue building
-
javadoc
- Parameters:
javadoc- TheJavadocon the field- Returns:
- this, to continue building
-
annotations
- Parameters:
annotations- Theannotationson the field- Returns:
- this, to continue building
-
annotation
- Parameters:
annotation- A singleannotationon the field- Returns:
- this, to continue building
-
visibility
- Parameters:
visibility- TheVisibilityof the field- Returns:
- this, to continue building
-
isStatic
Sets the field to be static- Returns:
- this, to continue building
-
isStatic
- Parameters:
isStatic- Whether the field is static or not- Returns:
- this, to continue building
-
isFinal
Sets the field to be final- Returns:
- this, to continue building
-
isFinal
- Parameters:
isFinal- Whether the field is final or not- Returns:
- this, to continue building
-
type
- Parameters:
type- The type of the field- Returns:
- this, to continue building
-
name
- Parameters:
name- The name of the field- Returns:
- this, to continue building
-
value
- Parameters:
value- The value assigned to the field- Returns:
- this, to continue building
-
checkForSpecificErrors
Checks for errors specific to the subclass- Returns:
- The errors found in the subclass, or an empty List
-
build
Checks for any errors in the current parameters, then builds a newJavaField- Returns:
- A newly built
JavaField - Throws:
IllegalArgumentException- if anything is wrong with the current parameters
-
constructField
Constructs aJavaFieldusing the set parameters- Returns:
- The newly built
JavaField
-