public class MethodBuilder extends BodyBuilderBase
Modifier and Type | Field | Description |
---|---|---|
private MethodDeclaration |
m_method |
Method invocation.
|
m_ast
m_declaration, m_source
Constructor | Description |
---|---|
MethodBuilder(ClassBuilder source,
MethodDeclaration method) |
Constructor.
|
Modifier and Type | Method | 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.
|
numberLiteral, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic, stringLiteral
addSourceComment, addSourceComment, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic
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()