|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.instruction.SwitchInstruction
public final class SwitchInstruction
An instruction representing a switch-case structure.
| Field Summary |
|---|
| Fields inherited from interface freemarker.template.instruction.Instruction |
|---|
ASSIGN_END, BREAK, CASE, COMMENT_END, COMPRESS_END, DEFAULT, ELSE, ELSEIF, FOREACH_END, FUNCTION_END, IF_END, LIST_END, NONE, NOPARSE_END, SWITCH_END, TRANSFORM_END |
| Fields inherited from interface freemarker.template.TemplateProcessor |
|---|
BREAK, EXIT, OK, UNCOMPILED_TEMPLATE |
| Constructor Summary | |
|---|---|
SwitchInstruction(Expression testExpression)
Constructor that takes an expression to be evaluated when testing each of the case statements. |
|
| Method Summary | |
|---|---|
void |
addCase(DefaultCaseInstruction caseInstruction)
Adds a case instruction to the switch. |
TemplateProcessor |
callBuilder(TemplateBuilder builder)
A TemplateBuilder can call this
method to have an Instruction call it back to be built. |
int |
getEndType()
Determine what type of end instruction this is, if any. |
boolean |
isEndInstruction()
Is this an end instruction? |
short |
process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
Process this <switch ... |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SwitchInstruction(Expression testExpression)
case statements.
testExpression - the expression to be tested.
java.lang.NullPointerException - the test expression was null
java.lang.IllegalArgumentException - the testExpression was not a scalar or number| Method Detail |
|---|
public void addCase(DefaultCaseInstruction caseInstruction)
caseInstruction - a CaseInstruction to be evaluated.public boolean isEndInstruction()
isEndInstruction in interface Instructionfalse, indicating that this is not an end
instructionpublic int getEndType()
getEndType in interface InstructionNONE, indicating that this is not an end instruction
public TemplateProcessor callBuilder(TemplateBuilder builder)
throws ParseException
TemplateBuilder can call this
method to have an Instruction call it back to be built. This
implementation calls the
TemplateBuilder.buildStatement(SwitchInstruction)
method, passing back a reference to itself. This approach is intended to
make type-checking of Instruction objects unnecessary.
callBuilder in interface Instructionbuilder - the builder to be called back by this method
ParseException
public short process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
throws java.io.IOException
<switch ... > instruction.
process in interface TemplateProcessormodelRoot - the root node of the data model.out - a Writer to send the output to.eventHandler - a TemplateEventAdapter for handling any events
that occur during processing.
java.io.IOException - an IO error occurred during processingpublic java.lang.String toString()
toString in class java.lang.ObjectString representing this instruction subtree
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||