|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(String macroName)
Create a RuntimeMacro instance. |
Method Summary | |
---|---|
String |
getName()
Return name of this Velocimacro. |
String |
getScopeName()
Override to always return "macro". |
int |
getType()
Velocimacros are always LINE type directives. |
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
Intialize the Runtime macro. |
boolean |
render(InternalContextAdapter context,
Writer writer,
Node node)
Velocimacro implementation is not known at the init time. |
boolean |
render(InternalContextAdapter context,
Writer writer,
Node node,
Renderable body)
This method is used with BlockMacro when we want to render a macro with a body AST. |
Methods inherited from class org.apache.velocity.runtime.directive.Directive |
---|
getColumn, getLine, getTemplateName, isScopeProvided, makeScope, postRender, preRender, 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(String macroName)
macroName
- name of the macroMethod Detail |
---|
public String getName()
getName
in class Directive
public String getScopeName()
getScopeName
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, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
render
in class Directive
context
- writer
- node
-
IOException
ResourceNotFoundException
ParseErrorException
MethodInvocationException
public boolean render(InternalContextAdapter context, Writer writer, Node node, Renderable body) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
context
- writer
- node
- body
- AST block that was enclosed in the macro body.
IOException
ResourceNotFoundException
ParseErrorException
MethodInvocationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |