public class RuntimeMacro extends Directive
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
strictRef
Indicates if we are running in strict reference mode.
|
BLOCK, LINE| 构造器和说明 |
|---|
RuntimeMacro(java.lang.String macroName)
Create a RuntimeMacro instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.String |
getName()
Return name of this Velocimacro.
|
java.lang.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,
java.io.Writer writer,
Node node)
Velocimacro implementation is not known at the init time.
|
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node,
Renderable body)
This method is used with BlockMacro when we want to render a macro with a body AST.
|
getColumn, getLine, getTemplateName, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocationpublic RuntimeMacro(java.lang.String macroName)
macroName - name of the macropublic java.lang.String getName()
public java.lang.String getScopeName()
getScopeName 在类中 Directivepublic int getType()
public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
public boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
render 在类中 Directivecontext - writer - node - java.io.IOExceptionResourceNotFoundExceptionParseErrorExceptionMethodInvocationExceptionpublic boolean render(InternalContextAdapter context, java.io.Writer writer, Node node, Renderable body) throws java.io.IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
context - writer - node - body - AST block that was enclosed in the macro body.java.io.IOExceptionResourceNotFoundExceptionParseErrorExceptionMethodInvocationException