|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.instruction.ElseInstruction
public class ElseInstruction
An instruction representing an if-else structure. The "else" part of the
structure will be executed if the condition expression evaluates to
true value.
As a special case, any "else" structures are performed the same way as "if"
structures, but with the test always returning true.
Unexpectedly, this is a superclass of the regular IfInstruction
class.
IfElseInstruction,
IfInstruction,
Serialized Form| Field Summary | |
|---|---|
protected TemplateProcessor |
body
The template body to process if the else clause is reached. |
| 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 | |
|---|---|
ElseInstruction()
Constructor to be used when evaluating the "else" part of the instruction. |
|
| Method Summary | |
|---|---|
TemplateProcessor |
callBuilder(TemplateBuilder builder)
A TemplateBuilder can call this method to have an
Instruction call it back to be built. |
boolean |
conditionMatches(TemplateWriteableHashModel modelRoot)
Tests the condition for which this "else" statement should match. |
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)
Evaluate the <else> instruction. |
void |
setBody(TemplateProcessor body)
Sets the body to be executed if the "if" expression is true. |
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 |
| Field Detail |
|---|
protected TemplateProcessor body
| Constructor Detail |
|---|
public ElseInstruction()
| Method Detail |
|---|
public boolean conditionMatches(TemplateWriteableHashModel modelRoot)
throws TemplateException
TemplateExceptionpublic final void setBody(TemplateProcessor body)
true.
body - a TemplateProcessor to be processed if the
condition is true.public final boolean isEndInstruction()
isEndInstruction in interface Instructiontrue, indicating that this is not an end instructionpublic int getEndType()
getEndType in interface InstructionELSE, indicating that this is an else instructionpublic final TemplateProcessor callBuilder(TemplateBuilder builder)
TemplateBuilder can call this method to have an
Instruction call it back to be built. For end instructions,
there is nothing more to be build, so return immediately.
callBuilder in interface Instructionbuilder - the builder to be called back by this method
public final short process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
throws java.io.IOException
<else> 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 | ||||||||