freemarker.template.instruction
Class CommentInstruction

java.lang.Object
  extended by freemarker.template.instruction.CommentInstruction
All Implemented Interfaces:
ContainerInstruction, Instruction, UnparsedInstruction, TemplateProcessor, java.io.Serializable

public final class CommentInstruction
extends java.lang.Object
implements UnparsedInstruction, java.io.Serializable

An instruction for commenting out a block of text or adding a remark.

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

Version:
$Id: CommentInstruction.java 1162 2013-04-20 12:04:32Z run2000 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface freemarker.template.instruction.Instruction
Instruction.EndType
 
Nested classes/interfaces inherited from interface freemarker.template.TemplateProcessor
TemplateProcessor.ExitStatus
 
Method Summary
 TemplateProcessor callBuilder(TemplateBuilder builder)
          Call the TemplateBuilder with this comment instruction.
 Instruction.EndType getEndType()
          Determine what type of end instruction this is, if any.
static CommentInstruction getInstance()
          Return a singleton instance of a comment instruction.
 boolean isEndInstruction()
          Is this an end instruction?
 TemplateProcessor.ExitStatus process(TemplateProcessorParameters p)
          Process this <comment> instruction.
 void setText(java.lang.String text)
          Sets the text of the comment.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static CommentInstruction getInstance()
Return a singleton instance of a comment instruction.

Returns:
a singleton CommentInstruction object

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 Instruction.EndType getEndType()
Determine what type of end instruction this is, if any.

Specified by:
getEndType in interface Instruction
Returns:
NONE, indicating that this is not an end instruction

callBuilder

public TemplateProcessor callBuilder(TemplateBuilder builder)
                              throws ParseException
Call the TemplateBuilder with this comment instruction.

Specified by:
callBuilder in interface Instruction
Parameters:
builder - the TemplateBuilder to be called back
Throws:
ParseException

setText

public void setText(java.lang.String text)
Sets the text of the comment.

Specified by:
setText in interface UnparsedInstruction
Parameters:
text - the text of the comment

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 comment end instruction, otherwise false

process

public TemplateProcessor.ExitStatus process(TemplateProcessorParameters p)
Process this <comment> instruction.

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

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
The String "comment"