Package org.jibx.schema.codegen
Class MethodBuilder
- java.lang.Object
-
- org.jibx.schema.codegen.ASTBuilderBase
-
- org.jibx.schema.codegen.BodyBuilderBase
-
- org.jibx.schema.codegen.MethodBuilder
-
public class MethodBuilder extends BodyBuilderBase
Abstract syntax tree method declaration builder. This adds convenience methods and control information to the base builder.
-
-
Field Summary
Fields Modifier and Type Field Description private MethodDeclaration
m_method
Method invocation.-
Fields inherited from class org.jibx.schema.codegen.BodyBuilderBase
m_declaration, m_source
-
Fields inherited from class org.jibx.schema.codegen.ASTBuilderBase
m_ast
-
-
Constructor Summary
Constructors Constructor Description MethodBuilder(ClassBuilder source, MethodDeclaration method)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods 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.-
Methods inherited from class org.jibx.schema.codegen.BodyBuilderBase
addSourceComment, addSourceComment, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic
-
Methods inherited from class org.jibx.schema.codegen.ASTBuilderBase
numberLiteral, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic, stringLiteral
-
-
-
-
Constructor Detail
-
MethodBuilder
public MethodBuilder(ClassBuilder source, MethodDeclaration method)
Constructor.- Parameters:
source
-method
-
-
-
Method Detail
-
getDeclaration
public MethodDeclaration getDeclaration()
Get the method declaration.- Returns:
- declaration
-
addParameter
public SingleVariableDeclaration addParameter(java.lang.String name, Type type)
Add a method parameter.- Parameters:
name
-type
-- Returns:
- declaration
-
addParameter
public SingleVariableDeclaration addParameter(java.lang.String name, java.lang.String type)
Add a method parameter.- Parameters:
name
-type
- fully-qualfied type name, or primitive name, with optional array suffixes- Returns:
- declaration
-
addThrows
public void addThrows(java.lang.String type)
Add an exception type to those thrown by the method.- Parameters:
type
- exception type
-
createBlock
public BlockBuilder createBlock()
Create a block builder for the method body.- Returns:
- builder
-
-