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
Modifier and TypeFieldDescriptionprivate List<JavaAnnotation>
Theannotations
on the fieldprivate boolean
Whether the field is final or notprivate String
The name of the fieldprivate String
The type of the fieldprivate String
The value assigned to the fieldprivate Visibility
TheVisibility
of the field -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionannotation
(JavaAnnotation annotation) annotations
(List<JavaAnnotation> annotations) build()
Checks for any errors in the current parameters, then builds a newJavaField
private void
Checks for any errors in the current parametersisFinal()
Sets the field to be finalisFinal
(boolean isFinal) visibility
(Visibility visibility)
-
Field Details
-
annotations
Theannotations
on the field -
visibility
TheVisibility
of 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
- Theannotations
on the field- Returns:
- this, to continue building
-
annotation
- Parameters:
annotation
- A singleannotation
on the field- Returns:
- this, to continue building
-
visibility
- Parameters:
visibility
- TheVisibility
of 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
-