Package asteroid.nodes
Class MethodNodeBuilder
- java.lang.Object
-
- asteroid.nodes.MethodNodeBuilder
-
public final class MethodNodeBuilder extends Object
Builder to create instance of typeMethodNode- Since:
- 0.1.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodNodebuild()Returns the configured instanceMethodNodeBuildercode(Statement code)Sets the content of the methodMethodNodeBuilderexceptions(ClassNode... exceptions)Declares which type of exceptions this method may throwstatic MethodNodeBuildermethod(String name)Sets the method name and creates an instance ofMethodNodeBuilderMethodNodeBuildermodifiers(int modifiers)Sets the method modifiers (public, protected...).MethodNodeBuilderparameters(Parameter... parameters)Declares which parameters this method may receiveMethodNodeBuilderreturnType(Class returnType)Sets the return type of the method
-
-
-
Method Detail
-
method
public static MethodNodeBuilder method(String name)
Sets the method name and creates an instance ofMethodNodeBuilder- Parameters:
name- the name of the method- Returns:
- the current builder instance
- Since:
- 0.1.0
-
returnType
public MethodNodeBuilder returnType(Class returnType)
Sets the return type of the method- Parameters:
returnType- aClassrepresenting the return type of the method- Returns:
- the current builder instance
- Since:
- 0.1.0
-
modifiers
public MethodNodeBuilder modifiers(int modifiers)
Sets the method modifiers (public, protected...). You can useTypesto find proper modifier values.- Parameters:
modifiers- an int representing the type of the modifiers- Returns:
- the current builder instance
- Since:
- 0.1.0
- See Also:
Types
-
parameters
public MethodNodeBuilder parameters(Parameter... parameters)
Declares which parameters this method may receive- Parameters:
parameters- an array of instances of typeParameter- Returns:
- the current builder instance
- Since:
- 0.1.0
-
exceptions
public MethodNodeBuilder exceptions(ClassNode... exceptions)
Declares which type of exceptions this method may throw- Parameters:
exceptions- an array ofClassNoderepresenting the different type of exceptions this method may throw- Returns:
- the current builder instance
- Since:
- 0.1.0
-
code
public MethodNodeBuilder code(Statement code)
Sets the content of the method- Parameters:
code- the method's code. It has to be of typeStatement- Returns:
- the current builder instance
- Since:
- 0.1.0
-
build
public MethodNode build()
Returns the configured instance- Returns:
- an instance of type
MethodNode - Since:
- 0.1.0
-
-