|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.schema.codegen.ASTBuilderBase
org.jibx.schema.codegen.StatementBuilderBase
org.jibx.schema.codegen.SwitchBuilder
public class SwitchBuilder
Switch statement builder. This wraps the AST switch representation with convenience methods and added control information.
Field Summary | |
---|---|
private SwitchStatement |
m_switch
Method invocation. |
Fields inherited from class org.jibx.schema.codegen.StatementBuilderBase |
---|
m_source |
Fields inherited from class org.jibx.schema.codegen.ASTBuilderBase |
---|
m_ast |
Constructor Summary | |
---|---|
SwitchBuilder(ClassBuilder source,
Expression expr)
Constructor. |
Method Summary | |
---|---|
void |
addDefault(StatementBuilderBase stmt)
Add default case to switch statement. |
void |
addNamedCase(java.lang.String name,
StatementBuilderBase stmt)
Add case to switch statement with a named constant as the match value. |
void |
addNumberCase(java.lang.String value,
StatementBuilderBase stmt)
Add case to switch statement with a number as the match value. |
(package private) Statement |
getStatement()
Get the statement. |
private static boolean |
isBreakNeeded(Statement stmt)
Check if a break statement is needed following the statement for a particular case. |
private BlockBuilder |
newCaseBlock(Expression expr)
Add case to switch statement with new block for case code. |
BlockBuilder |
newNamedCase(java.lang.String name)
Add case to switch statement with returned block for code. |
BlockBuilder |
newNumberCase(java.lang.String value)
Add case to switch statement with returned block for code. |
Methods inherited from class org.jibx.schema.codegen.ASTBuilderBase |
---|
numberLiteral, setFinal, setPrivate, setPrivateFinal, setPrivateStaticFinal, setPublic, setPublicStatic, setPublicStaticFinal, setStatic, stringLiteral |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final SwitchStatement m_switch
Constructor Detail |
---|
public SwitchBuilder(ClassBuilder source, Expression expr)
source
- expr
- expressionMethod Detail |
---|
Statement getStatement()
getStatement
in class StatementBuilderBase
private static boolean isBreakNeeded(Statement stmt)
stmt
-
true
if break needed, false
if notpublic void addNamedCase(java.lang.String name, StatementBuilderBase stmt)
name
- named constantstmt
- statement to be executedpublic void addNumberCase(java.lang.String value, StatementBuilderBase stmt)
value
- match valuestmt
- statement to be executedpublic void addDefault(StatementBuilderBase stmt)
stmt
- statement to be executedprivate BlockBuilder newCaseBlock(Expression expr)
expr
-
public BlockBuilder newNamedCase(java.lang.String name)
name
- named constant
public BlockBuilder newNumberCase(java.lang.String value)
value
- match value
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |