Class RuntimeMacro

java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.RuntimeMacro
All Implemented Interfaces:
Cloneable, DirectiveConstants

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 Details

    • macroName

      private String macroName
      Name of the macro
    • literal

      private String literal
      Literal text of the macro
    • node

      private Node node
      Node of the macro call
    • strictRef

      protected boolean strictRef
      Indicates if we are running in strict reference mode.
    • badArgsErrorMsg

      private String badArgsErrorMsg
      badArgsErrorMsg will be non null if the arguments to this macro are deamed bad at init time, see the init method. If his is non null, then this macro cannot be rendered, and if there is an attempt to render we throw an exception with this as the message.
  • Constructor Details

    • 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 Details