Class JavaMethod.JavaMethodBuilder
java.lang.Object
com.github.tadukoo.parsing.code.java.JavaMethod.JavaMethodBuilder
- Enclosing class:
- JavaMethod
Java Method Builder is used to build a new
JavaMethod. It contains the following parameters:
| Parameter | Description | Default or Required |
|---|---|---|
| annotations | The annotations on the method |
An empty list |
| visibility | The Visibility of the method |
Visibility.PUBLIC |
| returnType | The return type of the method | Required |
| name | The name of the method | null (used for constructors) |
| parameters | The parameters used in the method - pairs of type, then name | An empty list |
| throwTypes | The types that can be thrown by the method | An empty list |
| lines | The actual lines of code in the method | 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 methodThe actual lines of code in the methodprivate StringThe name of the methodThe parameters used in the method - pairs of type, then nameprivate StringThe return type of the methodThe types that can be thrown by the methodprivate VisibilityTheVisibilityof the method -
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 newJavaMethodprivate voidChecks for any errors in the current parametersparameters(List<com.github.tadukoo.util.tuple.Pair<String, String>> parameters) returnType(String returnType) throwTypes(List<String> throwTypes) visibility(Visibility visibility)
-
Field Details
-
annotations
Theannotationson the method -
visibility
TheVisibilityof the method -
returnType
The return type of the method -
name
The name of the method -
parameters
The parameters used in the method - pairs of type, then name -
throwTypes
The types that can be thrown by the method -
lines
The actual lines of code in the method
-
-
Constructor Details
-
JavaMethodBuilder
private JavaMethodBuilder()
-
-
Method Details
-
annotations
- Parameters:
annotations- Theannotationson the method- Returns:
- this, to continue building
-
annotation
- Parameters:
annotation- A singleannotationon the method- Returns:
- this, to continue building
-
visibility
- Parameters:
visibility- TheVisibilityof the method- Returns:
- this, to continue building
-
returnType
- Parameters:
returnType- The return type of the method- Returns:
- this, to continue building
-
name
- Parameters:
name- The name of the method- Returns:
- this, to continue building
-
parameters
public JavaMethod.JavaMethodBuilder parameters(List<com.github.tadukoo.util.tuple.Pair<String, String>> parameters) - Parameters:
parameters- The parameters used in the method - pairs of type, then name- Returns:
- this, to continue building
-
parameter
public JavaMethod.JavaMethodBuilder parameter(com.github.tadukoo.util.tuple.Pair<String, String> parameter) - Parameters:
parameter- A single parameter, with type first, then name - to add to the list- Returns:
- this, to continue building
-
parameter
- Parameters:
type- The type of the parameter to be addedname- The name of the parameter to be added- Returns:
- this, to continue building
-
throwTypes
- Parameters:
throwTypes- The types the method can throw- Returns:
- this, to continue building
-
throwType
- Parameters:
throwType- A type the method can throw - to add to the list- Returns:
- this, to continue building
-
lines
- Parameters:
lines- The actual lines of code in the method- Returns:
- this, to continue building
-
line
- Parameters:
line- A single line of code in the method, to add 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 newJavaMethod- Returns:
- A newly built
JavaMethod - Throws:
IllegalArgumentException- if anything is wrong with the current parameters
-