public class BlockBuilder extends StatementBuilderBase
m_sourcem_ast| Constructor and Description |
|---|
BlockBuilder(ClassBuilder source,
org.eclipse.jdt.core.dom.Block block)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAssignToName(org.eclipse.jdt.core.dom.Expression expr,
String name)
Append an assignment from an expression to a field or local variable.
|
void |
addAssignVariableToField(String vname,
String fname)
Append an assignment from a local variable to a field.
|
void |
addBreak()
Append a 'break' statement.
|
void |
addCall(InvocationBuilder call)
Append a method call statement.
|
void |
addExpressionStatement(ExpressionBuilderBase expr)
Append an expression statement.
|
void |
addIfElseIfStatement(ExpressionBuilderBase ifexpr,
ExpressionBuilderBase elsexpr,
BlockBuilder ifblock,
BlockBuilder elseblock)
Append an 'if-else-if' statement.
|
void |
addIfElseStatement(ExpressionBuilderBase expr,
BlockBuilder ifblock,
BlockBuilder elseblock)
Append an 'if-else' statement.
|
void |
addIfStatement(ExpressionBuilderBase expr,
BlockBuilder ifblock)
Append a simple 'if' statement (no else).
|
void |
addIndexedForStatement(String name,
String array,
BlockBuilder block)
Append a standard 'for' statement using an index variable over an array.
|
void |
addIteratedForStatement(String name,
org.eclipse.jdt.core.dom.Type type,
ExpressionBuilderBase init,
BlockBuilder block)
Append a standard 'for' statement using an iterator.
|
void |
addLocalVariableDeclaration(String type,
String vname)
Append a local variable declaration.
|
void |
addLocalVariableDeclaration(String tname,
String vname,
ExpressionBuilderBase expr)
Append a local variable declaration with initializer expression.
|
void |
addLocalVariableDeclaration(org.eclipse.jdt.core.dom.Type type,
String vname,
ExpressionBuilderBase expr)
Append a local variable declaration with initializer expression.
|
void |
addReturnExpression(ExpressionBuilderBase expr)
Append a statement returning the value of an expression.
|
void |
addReturnNamed(String name)
Append a statement returning the value of a field or local variable.
|
void |
addReturnNull()
Append a statement returning
null. |
void |
addStatement(StatementBuilderBase stmt)
Append a constructed statement.
|
void |
addSugaredForStatement(String name,
String type,
ExpressionBuilderBase expr,
BlockBuilder block)
Append a Java 5 "enhanced" 'for' statement.
|
SwitchBuilder |
addSwitch(ExpressionBuilderBase expr)
Append a 'switch' statement using a constructed expression as the switch value.
|
SwitchBuilder |
addSwitch(String name)
Append a 'switch' statement using a local variable or field name as the switch value.
|
void |
addThrowException(String type,
ExpressionBuilderBase expr)
Append a throw new exception statement.
|
void |
addThrowException(String type,
String text)
Append a throw new exception statement.
|
numberLiteral, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic, stringLiteralpublic BlockBuilder(ClassBuilder source, org.eclipse.jdt.core.dom.Block block)
source - block - public void addAssignToName(org.eclipse.jdt.core.dom.Expression expr,
String name)
expr - name - public void addAssignVariableToField(String vname, String fname)
vname - fname - public void addLocalVariableDeclaration(String type, String vname)
type - vname - public void addLocalVariableDeclaration(org.eclipse.jdt.core.dom.Type type,
String vname,
ExpressionBuilderBase expr)
type - vname - expr - initializer expressionpublic void addLocalVariableDeclaration(String tname, String vname, ExpressionBuilderBase expr)
tname - vname - expr - initializer expressionpublic void addIfStatement(ExpressionBuilderBase expr, BlockBuilder ifblock)
expr - conditional expressionifblock - block executed when condition truepublic void addIfElseStatement(ExpressionBuilderBase expr, BlockBuilder ifblock, BlockBuilder elseblock)
expr - conditional expressionifblock - block executed when condition trueelseblock - block executed when condition falsepublic void addIfElseIfStatement(ExpressionBuilderBase ifexpr, ExpressionBuilderBase elsexpr, BlockBuilder ifblock, BlockBuilder elseblock)
ifexpr - if conditional expressionelsexpr - if conditional expressionifblock - block executed when condition trueelseblock - block executed when condition falsepublic void addIteratedForStatement(String name, org.eclipse.jdt.core.dom.Type type, ExpressionBuilderBase init, BlockBuilder block)
name - iteration variable nametype - variable type (must be an iterator subclass or generic type)init - variable initialization expressionblock - statement body blockpublic void addIndexedForStatement(String name, String array, BlockBuilder block)
name - index variable namearray - array nameblock - statement body blockpublic void addSugaredForStatement(String name, String type, ExpressionBuilderBase expr, BlockBuilder block)
name - iteration variable nametype - iteration variable typeexpr - iteration source expressionblock - statement body blockpublic void addReturnExpression(ExpressionBuilderBase expr)
expr - expressionpublic void addReturnNamed(String name)
name - field namepublic void addReturnNull()
null.public void addThrowException(String type, String text)
type - exception typetext - public void addThrowException(String type, ExpressionBuilderBase expr)
type - exception typeexpr - initializer expressionpublic void addCall(InvocationBuilder call)
call - public void addBreak()
public SwitchBuilder addSwitch(String name)
name - public SwitchBuilder addSwitch(ExpressionBuilderBase expr)
expr - public void addExpressionStatement(ExpressionBuilderBase expr)
expr - public void addStatement(StatementBuilderBase stmt)
stmt - Copyright © 2005-2014 jibx.org. All Rights Reserved.