freemarker.template.instruction
Class AssignBlockInstruction

java.lang.Object
  extended by freemarker.template.instruction.GenericStartInstruction
      extended by 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

Field Summary
 
Fields inherited from class freemarker.template.instruction.GenericStartInstruction
body
 
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
AssignBlockInstruction(Variable variable)
          Constructor that takes a vairable to be assigned and the expression whose value should be assigned.
 
Method Summary
 short process(TemplateWriteableHashModel modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler)
          Process this <assign ...
 boolean testEndInstruction(Instruction endInstruction)
          Is this the right kind of instruction for the given EndInstruction?
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class freemarker.template.instruction.GenericStartInstruction
callBuilder, getEndType, isEndInstruction, setBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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
Method Detail

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 model
out - a Writer to send the output to
eventHandler - 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