|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.velocity.runtime.directive.Directive | +--org.apache.velocity.runtime.directive.Foreach
Foreach directive used for moving through arrays, or objects that provide an Iterator.
Field Summary | |
private int |
counterInitialValue
What value to start the loop counter at. |
private java.lang.String |
counterName
The name of the variable to use when placing the counter value into the context. |
private java.lang.String |
elementKey
The reference name used to access each of the elements in the list object. |
private static int |
INFO_ARRAY
Flag to indicate that the list object being used in an array. |
private static int |
INFO_COLLECTION
Flag to indicate that the list object being used is a Collection. |
private static int |
INFO_ENUMERATION
Flag to indicate that the list object being used is an Enumeration |
private static int |
INFO_ITERATOR
Flag to indicate that the list object being used provides an Iterator. |
private static int |
INFO_MAP
Flag to indicate that the list object being used is a Map. |
private static int |
UNKNOWN
|
Fields inherited from class org.apache.velocity.runtime.directive.Directive |
column, line, rsvc |
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
BLOCK, LINE |
Constructor Summary | |
Foreach()
|
Method Summary | |
private java.util.Iterator |
getIterator(InternalContextAdapter context,
Node node)
returns an Iterator to the collection in the #foreach() |
java.lang.String |
getName()
Return name of this directive. |
int |
getType()
Return type of this directive. |
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
simple init - init the tree and get the elementKey from the AST |
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node)
renders the #foreach() block |
Methods inherited from class org.apache.velocity.runtime.directive.Directive |
getColumn, getLine, setLocation |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int UNKNOWN
private static final int INFO_ARRAY
private static final int INFO_ITERATOR
private static final int INFO_MAP
private static final int INFO_COLLECTION
private static final int INFO_ENUMERATION
private java.lang.String counterName
private int counterInitialValue
private java.lang.String elementKey
Constructor Detail |
public Foreach()
Method Detail |
public java.lang.String getName()
getName
in class Directive
public int getType()
getType
in class Directive
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws java.lang.Exception
init
in class Directive
private java.util.Iterator getIterator(InternalContextAdapter context, Node node) throws MethodInvocationException
context
- current contextnode
- AST nodepublic boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException, MethodInvocationException, ResourceNotFoundException, ParseErrorException
render
in class Directive
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |