Class ExpressionNode

java.lang.Object
org.springframework.data.mongodb.core.spel.ExpressionNode
All Implemented Interfaces:
Iterable<ExpressionNode>
Direct Known Subclasses:
LiteralNode, MethodReferenceNode, NotOperatorNode, OperatorNode

public class ExpressionNode extends Object implements Iterable<ExpressionNode>
A value object for nodes in an expression. Allows iterating ove potentially available child ExpressionNodes.
Author:
Oliver Gierke, Christoph Strobl, Mark Paluch
  • Constructor Details

  • Method Details

    • from

      public static ExpressionNode from(SpelNode node, ExpressionState state)
      Factory method to create ExpressionNode's according to the given SpelNode and ExpressionState.
      Parameters:
      node -
      state - must not be null.
      Returns:
      an ExpressionNode for the given SpelNode or null if null was given for the SpelNode.
    • getName

      public String getName()
      Returns the name of the ExpressionNode.
      Returns:
    • isOfType

      public boolean isOfType(Class<?> type)
      Returns whether the current ExpressionNode is backed by the given type.
      Parameters:
      type - must not be null.
      Returns:
    • isMathematicalOperation

      public boolean isMathematicalOperation()
      Returns whether the ExpressionNode is a mathematical operation.
      Returns:
    • isLogicalOperator

      public boolean isLogicalOperator()
      Returns whether the ExpressionNode is a logical conjunction operation like &&, ||.
      Returns:
      Since:
      1.10
    • isLiteral

      public boolean isLiteral()
      Returns whether the ExpressionNode is a literal.
      Returns:
    • getValue

      @Nullable public Object getValue()
      Returns the value of the current node.
      Returns:
    • hasChildren

      public boolean hasChildren()
      Returns whether the current node has child nodes.
      Returns:
    • getChild

      public ExpressionNode getChild(int index)
      Returns the child ExpressionNode with the given index.
      Parameters:
      index - must not be negative.
      Returns:
    • hasfirstChildNotOfType

      public boolean hasfirstChildNotOfType(Class<?> type)
      Returns whether the ExpressionNode has a first child node that is not of the given type.
      Parameters:
      type - must not be null.
      Returns:
    • from

      protected ExpressionNode from(SpelNode node)
      Creates a new ExpressionNode from the given SpelNode.
      Parameters:
      node -
      Returns:
    • iterator

      public Iterator<ExpressionNode> iterator()
      Specified by:
      iterator in interface Iterable<ExpressionNode>