Class ReferenceNode.PlainReferenceNode

Enclosing class:
ReferenceNode

static class ReferenceNode.PlainReferenceNode extends ReferenceNode
A node in the parse tree that is a plain reference such as $x. This node may appear inside a more complex reference like $x.foo.
  • Field Details

  • Constructor Details

    • PlainReferenceNode

      PlainReferenceNode(String resourceName, int lineNumber, String id)
  • 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
    • isDefinedAndTrue

      boolean isDefinedAndTrue(EvaluationContext context)
      Description copied from class: ExpressionNode
      True if this is a defined value and it evaluates to true. This is the same as ExpressionNode.isTrue(com.google.auto.value.processor.escapevelocity.EvaluationContext) except that it is allowed for this to be undefined variable, in which it evaluates to false. The method is overridden for plain references so that undefined is the same as false. The reason is to support Velocity's idiom #if ($var), where it is not an error if $var is undefined.
      Overrides:
      isDefinedAndTrue in class ExpressionNode