freemarker.template.instruction
Class NOOPInstruction

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

public final class NOOPInstruction
extends java.lang.Object
implements Instruction, TemplateProcessor, java.io.Serializable

An instruction that does nothing. This is useful when we want to substitute one instruction for another. The best example of this is the way LinkedListTemplateBuilder deals with FunctionInstructions.

Note:
NOOPInstruction is a singleton instance. Use the getInstance() method to retrieve instances of this instruction.

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

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
 
Method Summary
 TemplateProcessor callBuilder(TemplateBuilder builder)
          A TemplateBuilder can call this method to have an Instruction call it back to be built.
 int getEndType()
          Retrieve the type of end instruction, if any.
static NOOPInstruction getInstance()
          Retrieves a singleton instance of NOOPInstruction.
 boolean isEndInstruction()
          Is this an end instruction?
 void process(TemplateModelRoot modelRoot, java.io.Writer out, TemplateRuntimeHandler eventHandler)
          Processes the contents of this TemplateProcessor and outputs the resulting text to a Writer.
 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
 

Method Detail

getInstance

public static NOOPInstruction getInstance()
Retrieves a singleton instance of NOOPInstruction.
Returns:
a singleton NOOPInstruction

isEndInstruction

public boolean isEndInstruction()
Is this an end instruction?
Specified by:
isEndInstruction in interface Instruction
Returns:
false, indicating that this is not an end instruction

getEndType

public int getEndType()
Retrieve the type of end instruction, if any.
Specified by:
getEndType in interface Instruction
Returns:
NONE, indicating that this is not an end instruction

callBuilder

public TemplateProcessor callBuilder(TemplateBuilder builder)
A TemplateBuilder can call this method to have an Instruction call it back to be built. This implementation returns immediately, since there is nothing additional to be parsed within this instruction.
Specified by:
callBuilder in interface Instruction
Parameters:
builder - the builder to be called back by this method

process

public void process(TemplateModelRoot modelRoot,
                    java.io.Writer out,
                    TemplateRuntimeHandler eventHandler)
Processes the contents of this TemplateProcessor and outputs the resulting text to a Writer. This implementation returns immediately, since there is nothing to output.
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.

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
the String "NOOP"