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
Abstract syntax tree method declaration builder. This adds convenience methods and control information to the base
builder.
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionSingleVariableDeclaration
addParameter
(String name, String type) Add a method parameter.SingleVariableDeclaration
addParameter
(String name, Type type) Add a method parameter.void
Add an exception type to those thrown by the method.Create a block builder for the method body.MethodDeclaration
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
-
Field Details
-
m_method
private final MethodDeclaration m_methodMethod invocation.
-
-
Constructor Details
-
MethodBuilder
Constructor.- Parameters:
source
-method
-
-
-
Method Details
-
getDeclaration
public MethodDeclaration getDeclaration()Get the method declaration.- Returns:
- declaration
-
addParameter
Add a method parameter.- Parameters:
name
-type
-- Returns:
- declaration
-
addParameter
Add a method parameter.- Parameters:
name
-type
- fully-qualfied type name, or primitive name, with optional array suffixes- Returns:
- declaration
-
addThrows
Add an exception type to those thrown by the method.- Parameters:
type
- exception type
-
createBlock
Create a block builder for the method body.- Returns:
- builder
-