freemarker.template.instruction
Class TransformInstruction
java.lang.Object
freemarker.template.instruction.GenericStartInstruction
freemarker.template.instruction.TransformInstruction
- All Implemented Interfaces:
- ContainerInstruction, Instruction, TemplateProcessor, java.io.Serializable
public final class TransformInstruction
- extends GenericStartInstruction
- implements java.io.Serializable
An instruction that processes a TemplateTransformModel.
- Version:
- $Id: TransformInstruction.java 1162 2013-04-20 12:04:32Z run2000 $
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TransformInstruction
public TransformInstruction(Variable variable)
- Creates new
TransformInstruction, with a given
transformation variable.
- Parameters:
variable - the variable representing the transformation to use
- Throws:
java.lang.NullPointerException - the variable was null
process
public TemplateProcessor.ExitStatus process(TemplateProcessorParameters p)
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.
- Specified by:
process in interface TemplateProcessor
- Parameters:
p - template processing parameters
- 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