public abstract class Directive extends java.lang.Object implements DirectiveConstants, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
private int |
column |
private int |
line |
protected org.slf4j.Logger |
log |
private boolean |
provideScope |
protected RuntimeServices |
rsvc |
private Template |
template |
BLOCK, LINE
Constructor and Description |
---|
Directive() |
Modifier and Type | Method and Description |
---|---|
void |
checkArgs(java.util.ArrayList<java.lang.Integer> argtypes,
Token t,
java.lang.String templateName)
The Parser calls this method during template parsing to check the arguments
types.
|
int |
getColumn()
for log msg purposes
|
int |
getLine()
for log msg purposes
|
abstract java.lang.String |
getName()
Return the name of this directive.
|
java.lang.String |
getScopeName() |
Template |
getTemplate()
returns the template in which this directive appears
|
java.lang.String |
getTemplateName() |
abstract int |
getType()
Get the directive type BLOCK/LINE.
|
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
How this directive is to be initialized.
|
boolean |
isScopeProvided() |
protected Scope |
makeScope(java.lang.Object prev) |
protected void |
postRender(InternalContextAdapter context)
This cleans up any scope control for this directive after rendering,
assuming the scope control was turned on.
|
protected void |
preRender(InternalContextAdapter context)
This creates and places the scope control for this directive
into the context (if scope provision is turned on).
|
abstract boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node)
How this directive is to be rendered
|
void |
setLocation(int line,
int column)
Allows the template location to be set.
|
void |
setLocation(int line,
int column,
Template template)
Allows the template location to be set.
|
private int line
private int column
private boolean provideScope
private Template template
protected org.slf4j.Logger log
protected RuntimeServices rsvc
public abstract java.lang.String getName()
public abstract int getType()
public void setLocation(int line, int column)
line
- column
- public void setLocation(int line, int column, Template template)
line
- column
- template
- public Template getTemplate()
public int getLine()
public int getColumn()
public java.lang.String getTemplateName()
public java.lang.String getScopeName()
public boolean isScopeProvided()
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException
rs
- context
- node
- TemplateInitException
public void checkArgs(java.util.ArrayList<java.lang.Integer> argtypes, Token t, java.lang.String templateName) throws ParseException
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
public abstract boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
context
- writer
- node
- java.io.IOException
ResourceNotFoundException
ParseErrorException
MethodInvocationException
protected void preRender(InternalContextAdapter context)
context
- protected Scope makeScope(java.lang.Object prev)
prev
- protected void postRender(InternalContextAdapter context)
context
-