Class JavaField.JavaFieldBuilder
java.lang.Object
com.github.tadukoo.parsing.code.java.JavaField.JavaFieldBuilder
- Enclosing class:
- JavaField
Java Field Builder is a builder to create a
JavaField. It has the following parameters:
| Parameter | Description | Default or Required |
|---|---|---|
| annotations | The annotations on the field |
An empty list |
| visibility | The Visibility of the field |
Visibility.PRIVATE |
| final | 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
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<JavaAnnotation>Theannotationson the fieldprivate booleanWhether the field is final or notprivate StringThe name of the fieldprivate StringThe type of the fieldprivate StringThe value assigned to the fieldprivate 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 newJavaFieldprivate voidChecks for any errors in the current parametersisFinal()Sets the field to be finalisFinal(boolean isFinal) visibility(Visibility visibility)
-
Field Details
-
annotations
Theannotationson the field -
visibility
TheVisibilityof the field -
isFinal
private 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
private JavaFieldBuilder()
-
-
Method Details
-
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
-
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
-
checkForErrors
private void checkForErrors()Checks for any errors in the current parameters- Throws:
IllegalArgumentException- if anything is wrong
-
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
-