|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujac.util.template.TemplateToken
public abstract class TemplateToken
Name: TemplateToken
Description: A base class for template tokens.
| Field Summary | |
|---|---|
protected BaseTemplateInterpreter |
interpreter
The template interpreter. |
protected int |
nextLegalAncestor
The next legal ancestor idx. |
protected TemplateTokenContainer |
parent
The parent token. |
protected int |
position
The position of the statement token in the expression. |
protected char[] |
source
The source code. |
| Constructor Summary | |
|---|---|
TemplateToken()
Constructs a TemplateToken instance with no specific attributes. |
|
TemplateToken(char[] source,
int position,
int length)
Constructs a TemplateToken instance with specific attributes. |
|
| Method Summary | |
|---|---|
boolean |
checkContainer(TemplateTokenContainer container)
Checks whether this token is valid for the given container. |
protected abstract TemplateToken |
cloneToken(BaseTemplateInterpreter interpreter,
TemplateTokenContainer parent)
Clones the token for caching reasons. |
abstract void |
execute(Writer writer,
TemplateContext ctx)
Excecutes the statement token. |
TokenAncestor[] |
getAncestorRules()
Gets the ancestor rules for this template. |
protected String |
getArgumentsAsString()
Gets the argument list as string. |
int |
getEndPosition()
Gets the end position of the statement token in the expression. |
protected String |
getIndention()
Gets the indention for prettier output. |
int |
getLength()
Gets the length of the statement token. |
int |
getLevel()
Getter method for the the property level. |
TemplateTokenContainer |
getParent()
Getter method for the the property parent. |
int |
getPosition()
Gets the position of the statement token in the expression. |
char[] |
getSource()
Gets the source code. |
String |
getTokenName()
Gets the token name. |
void |
initialize(BaseTemplateInterpreter interpreter,
char[] source,
int position,
int length)
Initializes the token. |
boolean |
isBodyToken()
Tells whether or this token has a body. |
boolean |
isLegalAncestor(String token)
Tells whether or the given token is a legal ancestor. |
boolean |
isLegalAncestor(TemplateToken token)
Tells whether or the given token is a legal ancestor. |
int |
parseArguments()
Parses the arguments of the token. |
protected int |
parseArguments(int offset)
Parses the arguments of the token. |
abstract void |
setArgument(Operand argument,
int idx)
Sets an argument. |
protected void |
setLength(int length)
Setter method for the the property length. |
void |
setLevel(int level)
Setter method for the the property level. |
void |
setParent(TemplateTokenContainer parent)
Setter method for the the property parent. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected BaseTemplateInterpreter interpreter
protected TemplateTokenContainer parent
protected char[] source
protected int position
protected int nextLegalAncestor
| Constructor Detail |
|---|
public TemplateToken()
public TemplateToken(char[] source,
int position,
int length)
source - The source code.position - The statement's position in the source code.length - The statement length.| Method Detail |
|---|
public String getTokenName()
public TokenAncestor[] getAncestorRules()
public boolean checkContainer(TemplateTokenContainer container)
container - The container that wants to add the token.
public TemplateTokenContainer getParent()
public void setParent(TemplateTokenContainer parent)
parent - The value to set for the property parent.public int getLevel()
public void setLevel(int level)
level - The value to set for the property level.public boolean isBodyToken()
public boolean isLegalAncestor(String token)
token - The token to test.
public boolean isLegalAncestor(TemplateToken token)
token - The token to test.
public int parseArguments()
throws ExpressionException
ExpressionException - In case the argument parsing failed.
protected int parseArguments(int offset)
throws ExpressionException
offset - The position fron which to parse the source.
ExpressionException - In case the argument parsing failed.
public void initialize(BaseTemplateInterpreter interpreter,
char[] source,
int position,
int length)
throws TemplateException
interpreter - The template interpreter.source - The source code.position - The start position.length - The length of the interresting area.
TemplateException - In case the initialization failed.public char[] getSource()
public int getLength()
protected void setLength(int length)
length - The value to set for the property length.public int getPosition()
public int getEndPosition()
public abstract void execute(Writer writer,
TemplateContext ctx)
throws TemplateException,
IOException
writer - The writer to write to.ctx - The template context.
TemplateException - If the token could not be successfuly executed.
IOException - In case an output failure occurred.
public abstract void setArgument(Operand argument,
int idx)
throws StatementException
argument - The argument to set.idx - The argument index.
StatementException - In case the given argument is not valid.protected String getIndention()
protected String getArgumentsAsString()
protected abstract TemplateToken cloneToken(BaseTemplateInterpreter interpreter,
TemplateTokenContainer parent)
interpreter - The interpreter to use.parent - The actual parent in the cloned object tree.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||