|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.RuntimeMacro
public class RuntimeMacro
This class acts as a proxy for potential macros. When the AST is built this class is inserted as a placeholder for the macro (whether or not the macro is actually defined). At render time we check whether there is a implementation for the macro call. If an implementation cannot be found the literal text is rendered.
Field Summary | |
---|---|
protected boolean |
strictRef
Indicates if we are running in strict reference mode. |
Fields inherited from class org.apache.velocity.runtime.directive.Directive |
---|
rsvc |
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
---|
BLOCK, LINE |
Constructor Summary | |
---|---|
RuntimeMacro(java.lang.String macroName,
java.lang.String sourceTemplate)
Create a RuntimeMacro instance. |
Method Summary | |
---|---|
java.lang.String |
getName()
Return name of this Velocimacro. |
int |
getType()
Velocimacros are always LINE type directives. |
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
Intialize the Runtime macro. |
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node)
Velocimacro implementation is not known at the init time. |
Methods inherited from class org.apache.velocity.runtime.directive.Directive |
---|
getColumn, getLine, getTemplateName, setLocation, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean strictRef
Constructor Detail |
---|
public RuntimeMacro(java.lang.String macroName, java.lang.String sourceTemplate)
macroName
- name of the macrosourceTemplate
- template where macro call is madeMethod 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)
init
in class Directive
rs
- runtime servicescontext
- InternalContextAdapternode
- node containing the macro callpublic boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
render
in class Directive
context
- writer
- node
-
java.io.IOException
ResourceNotFoundException
ParseErrorException
MethodInvocationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |