Class JavaClass.JavaClassBuilder
java.lang.Object
com.github.tadukoo.parsing.code.java.JavaClass.JavaClassBuilder
- Enclosing class:
- JavaClass
Java Class Builder is used to create a
JavaClass. It has the following parameters:
| Parameter | Description | Default or Required |
|---|---|---|
| packageName | The name of the package the class is in | Required |
| imports | The classes imported by the class | An empty list |
| staticImports | The classes imported statically by the class | An empty list |
| annotations | The annotations on the class |
An empty list |
| visibility | The Visibility of the class |
Visibility.PUBLIC |
| className | The name of the class | Required |
| superClassName | The name of the class this one extends (may be null) | null |
| fields | The fields on the class |
An empty list |
| methods | The methods in the class |
An empty list |
- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<JavaAnnotation>Theannotationson the classprivate StringThe name of the classThefieldson the classThe classes imported by the classprivate List<JavaMethod>Themethodsin the classprivate StringThe name of the package the class is inThe classes imported statically by the classprivate StringThe name of the class this one extends (may be null)private VisibilityTheVisibilityof the class -
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 newJavaClassprivate voidChecks for any errors in the current parametersmethod(JavaMethod method) methods(List<JavaMethod> methods) packageName(String packageName) singleImport(String singleImport) staticImport(String staticImport) staticImports(List<String> staticImports) superClassName(String superClassName) visibility(Visibility visibility)
-
Field Details
-
packageName
The name of the package the class is in -
imports
The classes imported by the class -
staticImports
The classes imported statically by the class -
annotations
Theannotationson the class -
visibility
TheVisibilityof the class -
className
The name of the class -
superClassName
The name of the class this one extends (may be null) -
fields
Thefieldson the class -
methods
Themethodsin the class
-
-
Constructor Details
-
JavaClassBuilder
private JavaClassBuilder()
-
-
Method Details
-
packageName
- Parameters:
packageName- The name of the package the class is in- Returns:
- this, to continue building
-
imports
- Parameters:
imports- The classes imported by the class- Returns:
- this, to continue building
-
singleImport
- Parameters:
singleImport- A single class imported by the class, to be added to the list- Returns:
- this, to continue building
-
staticImports
- Parameters:
staticImports- The classes imported statically by the class- Returns:
- this, to continue building
-
staticImport
- Parameters:
staticImport- A single class imported statically by the class, to be added to the list- Returns:
- this, to continue building
-
annotations
- Parameters:
annotations- Theannotationson the class- Returns:
- this, to continue building
-
annotation
- Parameters:
annotation- A singleannotationon the class- Returns:
- this, to continue building
-
visibility
- Parameters:
visibility- TheVisibilityof the class- Returns:
- this, to continue building
-
className
- Parameters:
className- The name of the class- Returns:
- this, to continue building
-
superClassName
- Parameters:
superClassName- The name of the class this one extends (may be null)- Returns:
- this, to continue building
-
fields
- Parameters:
fields- Thefieldson the class- Returns:
- this, to continue building
-
field
- Parameters:
field- Afieldon the class, to be added to the list- Returns:
- this, to continue building
-
methods
- Parameters:
methods- Themethodsin the class- Returns:
- this, to continue building
-
method
- Parameters:
method- Amethodin the class, to be added to the list- 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 newJavaClass- Returns:
- A newly built
JavaClass - Throws:
IllegalArgumentException- if anything is wrong with the current parameters
-