net.sourceforge.pmd.lang.vm.directive
Class RuntimeMacro

java.lang.Object
  extended by net.sourceforge.pmd.lang.vm.directive.Directive
      extended by net.sourceforge.pmd.lang.vm.directive.RuntimeMacro
All Implemented Interfaces:
Cloneable

public class RuntimeMacro
extends Directive

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.

Since:
1.6

Field Summary
 
Fields inherited from class net.sourceforge.pmd.lang.vm.directive.Directive
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.
 
Methods inherited from class net.sourceforge.pmd.lang.vm.directive.Directive
getColumn, getLine, getTemplateName, isScopeProvided, setLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeMacro

public RuntimeMacro(String macroName)
Create a RuntimeMacro instance. Macro name and source template stored for later use.

Parameters:
macroName - name of the macro
Method Detail

getName

public String getName()
Return name of this Velocimacro.

Specified by:
getName in class Directive
Returns:
The name of this Velocimacro.

getScopeName

public String getScopeName()
Override to always return "macro". We don't want to use the macro name here, since when writing VTL that uses the scope, we are within a #macro call. The macro name will instead be used as the scope name when defining the body of a BlockMacro.

Overrides:
getScopeName in class Directive

getType

public int getType()
Velocimacros are always LINE type directives.

Specified by:
getType in class Directive
Returns:
The type of this directive.


Copyright © 2002–2015 InfoEther. All rights reserved.