freemarker.template.instruction
Interface Instruction

All Known Subinterfaces:
UnparsedInstruction
All Known Implementing Classes:
DefaultCaseInstruction, ElseInstruction, EmptyInstruction, EndInstruction, GenericStartInstruction, NOOPInstruction, TextBlockInstruction, IfElseInstruction, SwitchInstruction

public interface Instruction

An interface that parsed instructions must implement.

Version:
$Id: Instruction.java,v 1.15 2003/11/10 03:55:42 run2000 Exp $

Field Summary
static int BREAK
          Constant returned by getEndType() indicating that this is a break instruction.
static int CASE
          Constant returned by getEndType() indicating that this is a case instruction.
static int COMMENT_END
          Constant returned by getEndType() indicating that this is a comment end instruction.
static int COMPRESS_END
          Constant returned by getEndType() indicating that this is a compress end instruction.
static int DEFAULT
          Constant returned by getEndType() indicating that this is a default instruction.
static int ELSE
          Constant returned by getEndType() indicating that this is an else instruction.
static int ELSEIF
          Constant returned by getEndType() indicating that this is an elseif instruction.
static int FOREACH_END
          Constant returned by getEndType() indicating that this is a foreach end instruction.
static int FUNCTION_END
          Constant returned by getEndType() indicating that this is a function end instruction.
static int IF_END
          Constant returned by getEndType() indicating that this is an if end instruction.
static int LIST_END
          Constant returned by getEndType() indicating that this is a list end instruction.
static int NONE
          Constant returned by getEndType() indicating that this is not an end instruction.
static int NOPARSE_END
          Constant returned by getEndType() indicating that this is a noparse end instruction.
static int SWITCH_END
          Constant returned by getEndType() indicating that this is a switch end instruction.
static int TRANSFORM_END
          Constant returned by getEndType() indicating that this is a transform end instruction.
 
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.
 boolean isEndInstruction()
          Is this an end instruction?
 

Field Detail

NONE

public static final int NONE
Constant returned by getEndType() indicating that this is not an end instruction.

BREAK

public static final int BREAK
Constant returned by getEndType() indicating that this is a break instruction.

CASE

public static final int CASE
Constant returned by getEndType() indicating that this is a case instruction.

COMPRESS_END

public static final int COMPRESS_END
Constant returned by getEndType() indicating that this is a compress end instruction.

ELSE

public static final int ELSE
Constant returned by getEndType() indicating that this is an else instruction.

FUNCTION_END

public static final int FUNCTION_END
Constant returned by getEndType() indicating that this is a function end instruction.

IF_END

public static final int IF_END
Constant returned by getEndType() indicating that this is an if end instruction.

LIST_END

public static final int LIST_END
Constant returned by getEndType() indicating that this is a list end instruction.

SWITCH_END

public static final int SWITCH_END
Constant returned by getEndType() indicating that this is a switch end instruction.

COMMENT_END

public static final int COMMENT_END
Constant returned by getEndType() indicating that this is a comment end instruction.

FOREACH_END

public static final int FOREACH_END
Constant returned by getEndType() indicating that this is a foreach end instruction.

NOPARSE_END

public static final int NOPARSE_END
Constant returned by getEndType() indicating that this is a noparse end instruction.

TRANSFORM_END

public static final int TRANSFORM_END
Constant returned by getEndType() indicating that this is a transform end instruction.

ELSEIF

public static final int ELSEIF
Constant returned by getEndType() indicating that this is an elseif instruction.

DEFAULT

public static final int DEFAULT
Constant returned by getEndType() indicating that this is a default instruction.
Method Detail

isEndInstruction

public boolean isEndInstruction()
Is this an end instruction?
Returns:
true if this instruction marks the end of a statement, otherwise false

getEndType

public int getEndType()
Retrieve the type of end instruction, if any.
Returns:
the type of this instruction if it is an end instruction, otherwise NONE.

callBuilder

public TemplateProcessor callBuilder(TemplateBuilder builder)
                              throws ParseException
A TemplateBuilder can call this method to have an Instruction call it back to be built. The Instruction will call the appropriate TemplateBuilder.buildStatement() method for its subclass, passing back a reference to itself. This approach is intended to make type-checking of Instruction objects unnecessary.
Parameters:
builder - the builder to be called back by this method