Interface EvaluationContext

  • All Known Implementing Classes:
    EvaluationContext.PlainEvaluationContext, Macro.MacroEvaluationContext

    interface EvaluationContext
    The context of a template evaluation. This consists of the template variables and the template macros. The template variables start with the values supplied by the evaluation call, and can be changed by #set directives and during the execution of #foreach and macro calls. The macros are extracted from the template during parsing and never change thereafter.
    • Method Detail

      • getVar

        java.lang.Object getVar​(java.lang.String var)
      • varIsDefined

        boolean varIsDefined​(java.lang.String var)
      • setVar

        java.lang.Runnable setVar​(java.lang.String var,
                                  java.lang.Object value)
        Sets the given variable to the given value.
        Returns:
        a Runnable that will restore the variable to the value it had before. If the variable was undefined before this method was executed, the Runnable will make it undefined again. This allows us to restore the state of $x after #foreach ($x in ...).