freemarker.template.instruction
Class ListInstruction
java.lang.Object
|
+--freemarker.template.instruction.GenericStartInstruction
|
+--freemarker.template.instruction.ListInstruction
- All Implemented Interfaces:
- ContainerInstruction, Instruction, java.io.Serializable, TemplateProcessor
- public final class ListInstruction
- extends GenericStartInstruction
An instruction that processes a TemplateListModel
or TemplateListModel2
.
This can be either in the form of a <list ... as ...>
instruction or a <foreach ... in ...>
instruction.
- Version:
- $Id: ListInstruction.java,v 1.29 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 |
Constructor Summary |
ListInstruction(Expression listExpression,
Identifier indexVariable)
Constructs a list/foreach instruction containing the list variable
and the index variable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ListInstruction
public ListInstruction(Expression listExpression,
Identifier indexVariable)
- Constructs a list/foreach instruction containing the list variable
and the index variable.
- Parameters:
listExpression
- a variable or list expression referring to a
TemplateListModel
.indexVariable
- an arbitrary index variable.- Throws:
NullPointerException
- list expression or index variable are nulljava.lang.IllegalArgumentException
- the list expression wasn't a list
testEndInstruction
public boolean testEndInstruction(Instruction endInstruction)
- Is this the right kind of instruction for the given
EndInstruction
?
- Parameters:
endInstruction
- the end instruction we're testing- Returns:
true
if the EndInstruction
is a
list end instruction, otherwise false
process
public void process(TemplateModelRoot modelRoot,
java.io.Writer out,
TemplateRuntimeHandler eventHandler)
throws java.io.IOException
- Processes the
<list ... >
or
<foreach ... >
instruction.
- 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:
- a
String
representing this instruction subtree