freemarker.template.instruction
Class AssignBlockInstruction
java.lang.Object
freemarker.template.instruction.GenericStartInstruction
freemarker.template.instruction.AssignBlockInstruction
- All Implemented Interfaces:
- ContainerInstruction, Instruction, TemplateProcessor, java.io.Serializable
public final class AssignBlockInstruction
- extends GenericStartInstruction
- implements java.io.Serializable
An instruction that assigns a template block to a single-identifier variable.
- Since:
- 1.9
- See Also:
- Serialized Form
| 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 |
|
Constructor Summary |
AssignBlockInstruction(Variable variable)
Constructor that takes a vairable to be assigned and the expression whose
value should be assigned. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AssignBlockInstruction
public AssignBlockInstruction(Variable variable)
- Constructor that takes a vairable to be assigned and the expression whose
value should be assigned.
- Parameters:
variable - the variable to assign to.
- Throws:
java.lang.NullPointerException - the variable or value is null
java.lang.IllegalArgumentException - attempt to assign variable to an iterator
process
public short process(TemplateWriteableHashModel modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
throws java.io.IOException
- Process this
<assign ... > block instruction.
- Specified by:
process in interface TemplateProcessor
- Parameters:
modelRoot - the root node of the data modelout - a Writer to send the output toeventHandler - a TemplateEventAdapter for handling any events
that occur during processing
- Returns:
- an exit code indicating how the process terminated, typically
used for short-circuiting template processing
- Throws:
java.io.IOException - an IO error occurred during processing
testEndInstruction
public boolean testEndInstruction(Instruction endInstruction)
- Is this the right kind of instruction for the given
EndInstruction?
- Specified by:
testEndInstruction in interface ContainerInstruction
- Parameters:
endInstruction - the end instruction we're testing
- Returns:
true if the EndInstruction is a
transform end instruction, otherwise false
toString
public java.lang.String toString()
- Returns a string representation of the object.
- Overrides:
toString in class java.lang.Object
- Returns:
- a
String representing this instruction subtree