Class DirectiveNode.IfNode

Enclosing class:
DirectiveNode

static class DirectiveNode.IfNode extends DirectiveNode
A node in the parse tree representing an #if construct. All instances of this class have a true subtree and a false subtree. For a plain #if (cond) body #end, the false subtree will be empty. For #if (cond1) body1 #elseif (cond2) body2 #else body3 #end, the false subtree will contain a nested IfNode, as if #else #if had been used instead of #elseif.
  • Field Details

    • condition

      private final ExpressionNode condition
    • truePart

      private final Node truePart
    • falsePart

      private final Node falsePart
  • Constructor Details

  • Method Details

    • evaluate

      Object evaluate(EvaluationContext context)
      Description copied from class: Node
      Returns the result of evaluating this node in the given context. This result may be used as part of a further operation, for example evaluating 2 + 3 to 5 in order to set $x to 5 in #set ($x = 2 + 3). Or it may be used directly as part of the template output, for example evaluating replacing name by Fred in My name is $name..
      Specified by:
      evaluate in class Node