Class ConstantExpressionNode


  • class ConstantExpressionNode
    extends ExpressionNode
    A node in the parse tree representing a constant value. Evaluating the node yields the constant value. Instances of this class are used both in expressions, like the 23 in #set ($x = 23), and for literal text in templates. In the template...
    
     abc#{if}($x == 5)def#{end}xyz
     
    ...each of the strings abc, def, xyz is represented by an instance of this class that evaluates to that string, and the value 5 is represented by an instance of this class that evaluates to the integer 5.
    • Field Detail

      • value

        private final java.lang.Object value
    • Constructor Detail

      • ConstantExpressionNode

        ConstantExpressionNode​(java.lang.String resourceName,
                               int lineNumber,
                               java.lang.Object value)
    • Method Detail

      • evaluate

        java.lang.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