Spring Data MongoDB - Core

org.springframework.data.mongodb.core.spel
Class ExpressionNode

java.lang.Object
  extended by org.springframework.data.mongodb.core.spel.ExpressionNode
All Implemented Interfaces:
Iterable<ExpressionNode>
Direct Known Subclasses:
LiteralNode, MethodReferenceNode, 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

Constructor Summary
protected ExpressionNode(SpelNode node, ExpressionState state)
          Creates a new ExpressionNode from the given SpelNode and ExpressionState.
 
Method Summary
protected  ExpressionNode from(SpelNode node)
          Creates a new ExpressionNode from the given SpelNode.
static ExpressionNode from(SpelNode node, ExpressionState state)
          Factory method to create ExpressionNode's according to the given SpelNode and ExpressionState.
 ExpressionNode getChild(int index)
          Returns the child ExpressionNode with the given index.
 String getName()
          Returns the name of the ExpressionNode.
 Object getValue()
          Returns the value of the current node.
 boolean hasChildren()
          Returns whether the current node has child nodes.
 boolean hasfirstChildNotOfType(Class<?> type)
          Returns whether the ExpressionNode has a first child node that is not of the given type.
 boolean isLiteral()
          Returns whether the ExpressionNode is a literal.
 boolean isMathematicalOperation()
          Returns whether the ExpressionNode is a mathematical operation.
 boolean isOfType(Class<?> type)
          Returns whether the current ExpressionNode is backed by the given type.
 Iterator<ExpressionNode> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionNode

protected ExpressionNode(SpelNode node,
                         ExpressionState state)
Creates a new ExpressionNode from the given SpelNode and ExpressionState.

Parameters:
node - must not be null.
state - must not be null.
Method Detail

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:

isLiteral

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

Returns:

getValue

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>

Spring Data MongoDB - Core

Copyright © 2011-2014-2014 Pivotal Software, Inc.. All Rights Reserved.