public class MethodBuilder extends BodyBuilderBase
Modifier and Type | Field and Description |
---|---|
private MethodDeclaration |
m_method
Method invocation.
|
m_declaration, m_source
m_ast
Constructor and Description |
---|
MethodBuilder(ClassBuilder source,
MethodDeclaration method)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SingleVariableDeclaration |
addParameter(java.lang.String name,
java.lang.String type)
Add a method parameter.
|
SingleVariableDeclaration |
addParameter(java.lang.String name,
Type type)
Add a method parameter.
|
void |
addThrows(java.lang.String type)
Add an exception type to those thrown by the method.
|
BlockBuilder |
createBlock()
Create a block builder for the method body.
|
MethodDeclaration |
getDeclaration()
Get the method declaration.
|
addSourceComment, addSourceComment, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic
numberLiteral, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic, stringLiteral
public MethodBuilder(ClassBuilder source, MethodDeclaration method)
source
- method
- public MethodDeclaration getDeclaration()
public SingleVariableDeclaration addParameter(java.lang.String name, Type type)
name
- type
- public SingleVariableDeclaration addParameter(java.lang.String name, java.lang.String type)
name
- type
- fully-qualfied type name, or primitive name, with optional array suffixespublic void addThrows(java.lang.String type)
type
- exception typepublic BlockBuilder createBlock()