|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.templat.parser.TemplateParser
public class TemplateParser
Parser to render a (tokenized) template, given optional arguments.
The parse method performs this action. The other methods
are for use by the tokens, who manipulate the context and parse position
of this parser.
| Field Summary | |
|---|---|
static String |
VAR_ARGS
Internal variable holding the arguments to the template |
static String |
VAR_IF
Internal variable used by IF statements |
static String |
VAR_LOOP_INDEX
Internal variable used by LOOP statements |
static String |
VAR_LOOP_TIMES
Internal variable used by LOOP statements |
static String |
VAR_URL
Internal variable holding the URL of the template |
| Constructor Summary | |
|---|---|
TemplateParser(List<TemplateToken> rToken,
List<Object> rArg,
URL url)
Initializes this parser to use the given tokenized template ( tToken),
passing it the given arguments. |
|
| Method Summary | |
|---|---|
void |
forgetParsePosition()
Discards the parse position (from the internal stack) that was saved by a previous call to saveParsePosition. |
ContextStack |
getContext()
Gets this parser's stack of contexts. |
void |
parse(Appendable appendTo)
Parses this template and appends the rendered result to the given Appendable. |
void |
restoreParsePosition()
Restores the parse position (from the internal stack) that was saved by a previous call to saveParsePosition. |
void |
saveParsePosition()
Saves the current parse position (on an internal stack). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VAR_IF
public static final String VAR_LOOP_INDEX
public static final String VAR_LOOP_TIMES
public static final String VAR_ARGS
public static final String VAR_URL
| Constructor Detail |
|---|
public TemplateParser(List<TemplateToken> rToken,
List<Object> rArg,
URL url)
tToken),
passing it the given arguments.
rToken - tokenized templaterArg - arguments to pass into the templateurl - the URL of the template (which is used to locate any included templates)| Method Detail |
|---|
public void parse(Appendable appendTo)
throws TemplateParsingException
Appendable.
This method calls each token's parse method to have that token perform
its action. This parser maintains the context (variables and their values) for
use by the tokens.
appendTo - Appendable to append the result to
TemplateParsingExceptionpublic void saveParsePosition()
public void restoreParsePosition()
saveParsePosition.
Used by some tokens.
public void forgetParsePosition()
saveParsePosition.
Used by some tokens.
public ContextStack getContext()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||