freemarker.template.instruction
Class TransformInstruction

java.lang.Object
  |
  +--freemarker.template.instruction.GenericStartInstruction
        |
        +--freemarker.template.instruction.TransformInstruction
All Implemented Interfaces:
ContainerInstruction, Instruction, java.io.Serializable, TemplateProcessor

public final class TransformInstruction
extends GenericStartInstruction
implements java.io.Serializable

An instruction that processes a TemplateTransformModel.

Version:
$Id: TransformInstruction.java,v 1.27 2003/11/27 11:36:45 run2000 Exp $
See Also:
Serialized Form

Fields inherited from class freemarker.template.instruction.GenericStartInstruction
body
 
Fields inherited from interface freemarker.template.instruction.Instruction
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
TransformInstruction(Variable variable)
          Creates new TransformInstruction, with a given transformation variable.
 
Method Summary
 void process(TemplateModelRoot modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler)
          Performs a <transform ...
 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

TransformInstruction

public TransformInstruction(Variable variable)
Creates new TransformInstruction, with a given transformation variable.
Parameters:
variable - the variable representing the transformation to use
Throws:
NullPointerException - the variable was null
Method Detail

process

public void process(TemplateModelRoot modelRoot,
                    java.io.Writer out,
                    TemplateRuntimeHandler eventHandler)
             throws java.io.IOException

Performs a <transform ... > operation on any child instructions. In the event that a transformation cannot be found or is empty, processing of the given block proceeds without transformation.

Note:
This implementation is time-efficient rather than space efficient. For a space-efficient tradeoff, use PipeReader and PipeWriter instead. PipeWriter would need to be in a separate thread.

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.

testEndInstruction

public boolean testEndInstruction(Instruction endInstruction)
Is this the right kind of instruction for the given EndInstruction?
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