freemarker.template.instruction
Class CaseInstruction

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

public final class CaseInstruction
extends DefaultCaseInstruction
implements java.io.Serializable

Represents a case in a switch statement. Unexpectedly, this is subclassed from the DefaultCaseInstruction class.

Version:
$Id: CaseInstruction.java,v 1.23 2003/11/28 21:24:45 run2000 Exp $
See Also:
DefaultCaseInstruction, SwitchInstruction, Serialized Form

Fields inherited from class freemarker.template.instruction.DefaultCaseInstruction
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
CaseInstruction(Expression expression)
          Constructor that takes an Expression to be evaluated when the case instruction is encountered.
 
Method Summary
 int getEndType()
          Retrieve the type of end instruction, if any.
 Expression getExpression()
          Retrieves the Expression to be evaluated when the case instruction is encountered.
 boolean hasBreak()
          Does this case instruction contain a break instruction?
 boolean isDefault()
          Is this the default case?
 void setBreak(boolean hasBreak)
          Sets whether this case instruction contains a break instruction.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class freemarker.template.instruction.DefaultCaseInstruction
callBuilder, isEndInstruction, process, setBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseInstruction

public CaseInstruction(Expression expression)
Constructor that takes an Expression to be evaluated when the case instruction is encountered.
Parameters:
expression - the Expression associated with this Case.
Throws:
NullPointerException - the expression was null
java.lang.IllegalArgumentException - the expression was not a string or number
Method Detail

getExpression

public Expression getExpression()
Retrieves the Expression to be evaluated when the case instruction is encountered.
Overrides:
getExpression in class DefaultCaseInstruction
Returns:
the Expression associated with this CaseInstruction

isDefault

public boolean isDefault()
Is this the default case?
Overrides:
isDefault in class DefaultCaseInstruction
Returns:
true if this is the default case, otherwise false

setBreak

public void setBreak(boolean hasBreak)
Sets whether this case instruction contains a break instruction.
Overrides:
setBreak in class DefaultCaseInstruction
Parameters:
hasBreak - true if this CaseInstruction has a break, otherwise false

hasBreak

public boolean hasBreak()
Does this case instruction contain a break instruction?
Overrides:
hasBreak in class DefaultCaseInstruction
Returns:
true if this Case has a break instruction, otherwise false

getEndType

public int getEndType()
Retrieve the type of end instruction, if any.
Overrides:
getEndType in class DefaultCaseInstruction
Returns:
CASE

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class DefaultCaseInstruction
Returns:
a String representing this instruction subtree