Package com.github.tadukoo.java.field
Class JavaFieldBuilder<FieldType extends JavaField>
java.lang.Object
com.github.tadukoo.java.field.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 |
|---|---|---|
| javadoc | The Javadoc on the field |
null |
| annotations | The annotations on the field |
An empty list |
| visibility | The Visibility of the field |
Visibility.NONE |
| 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:
- Beta v.0.6
- 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 JavaTypeThetypeof 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 parametersCopies the settings from the givenfieldto this builderisFinal()Sets the field to be finalisFinal(boolean isFinal) isStatic()Sets the field to be staticisStatic(boolean isStatic) visibility(Visibility visibility)
-
Field Details
-
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
Thetypeof 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
-
copy
Copies the settings from the givenfieldto this builder- Parameters:
field- Thefieldto copy settings from- 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- Thetypeof the field- Returns:
- this, to continue building
-
type
- Parameters:
typeText- The text to parse for thetypeof 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
-