public class For extends Foreach
Foreach
Modifier and Type | Field and Description |
---|---|
protected int |
counterInitialValue |
protected String |
counterName |
BLOCK, LINE
Constructor and Description |
---|
For() |
Modifier and Type | Method and Description |
---|---|
void |
checkArgs(ArrayList<Integer> argtypes,
Token t,
String templateName)
We do not allow a word token in any other arg position except for the 2nd
since we are looking for the pattern #foreach($foo in $bar).
|
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,
Writer writer,
Node node)
renders the #foreach() block
|
protected void |
renderBlock(InternalContextAdapter context,
Writer writer,
Node node) |
clean, getIterator, put
getColumn, getLine, getScopeName, getTemplate, getTemplateName, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocation
protected String counterName
protected int counterInitialValue
public String getName()
Foreach
public int getType()
Foreach
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException
Foreach
init
in class Foreach
TemplateInitException
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException
Foreach
render
in class Foreach
IOException
protected void renderBlock(InternalContextAdapter context, Writer writer, Node node) throws IOException
renderBlock
in class Foreach
IOException
public void checkArgs(ArrayList<Integer> argtypes, Token t, String templateName) throws ParseException
checkArgs
in class Foreach
argtypes
- type, Array of argument types of each argument to the directive
for example ParserTreeConstants.JJTWORDt
- token of directivetemplateName
- the name of the template this directive is referenced in.ParseException
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.