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
Modifier and TypeFieldDescriptionprivate List<JavaAnnotation>
Theannotations
on the classprivate String
The name of the classThefields
on the classThe classes imported by the classprivate List<JavaMethod>
Themethods
in the classprivate String
The name of the package the class is inThe classes imported statically by the classprivate String
The name of the class this one extends (may be null)private Visibility
TheVisibility
of the class -
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 newJavaClass
private void
Checks 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
Theannotations
on the class -
visibility
TheVisibility
of the class -
className
The name of the class -
superClassName
The name of the class this one extends (may be null) -
fields
Thefields
on the class -
methods
Themethods
in 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
- Theannotations
on the class- Returns:
- this, to continue building
-
annotation
- Parameters:
annotation
- A singleannotation
on the class- Returns:
- this, to continue building
-
visibility
- Parameters:
visibility
- TheVisibility
of 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
- Thefields
on the class- Returns:
- this, to continue building
-
field
- Parameters:
field
- Afield
on the class, to be added to the list- Returns:
- this, to continue building
-
methods
- Parameters:
methods
- Themethods
in the class- Returns:
- this, to continue building
-
method
- Parameters:
method
- Amethod
in 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
-