Class ExpressionTransformationContextSupport<T extends ExpressionNode>
java.lang.Object
org.springframework.data.mongodb.core.spel.ExpressionTransformationContextSupport<T>
The context for an
ExpressionNode transformation.- Author:
- Thomas Darimont, Oliver Gierke, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionExpressionTransformationContextSupport(T currentNode, @Nullable ExpressionNode parentNode, @Nullable org.bson.Document previousOperationObject) Creates a newExpressionTransformationContextSupportfor the givenExpressionNodes and an optional previous operation. -
Method Summary
Modifier and TypeMethodDescriptionorg.bson.DocumentaddToPreviousOperation(@Nullable Object value) Adds the given value to the previous operation and returns it.@Nullable ObjectaddToPreviousOrReturn(@Nullable Object value) Adds the given value to the previous operation if one is present or returns the value to add as is.Returns the currentExpressionNode.@Nullable ExpressionNodeReturns the parentExpressionNodeor null if none available.@Nullable org.bson.DocumentReturns the previously accumulated operation object or null if none available.booleanReturns whether a previous operation is present.booleanReturns whether the parent node is of the same operation as the current node.
-
Constructor Details
-
ExpressionTransformationContextSupport
public ExpressionTransformationContextSupport(T currentNode, @Nullable ExpressionNode parentNode, @Nullable org.bson.Document previousOperationObject) Creates a newExpressionTransformationContextSupportfor the givenExpressionNodes and an optional previous operation.- Parameters:
currentNode- must not be null.parentNode- may be null.previousOperationObject- may be null.
-
-
Method Details
-
getCurrentNode
-
getParentNode
Returns the parentExpressionNodeor null if none available.- Returns:
-
getPreviousOperationObject
public @Nullable org.bson.Document getPreviousOperationObject()Returns the previously accumulated operation object or null if none available. Rather than manually adding stuff to the object prefer usingaddToPreviousOrReturn(Object)to transparently do if one is present.- Returns:
- See Also:
-
hasPreviousOperation
public boolean hasPreviousOperation()Returns whether a previous operation is present.- Returns:
-
parentIsSameOperation
public boolean parentIsSameOperation()Returns whether the parent node is of the same operation as the current node.- Returns:
-
addToPreviousOperation
Adds the given value to the previous operation and returns it.- Parameters:
value-- Returns:
-
addToPreviousOrReturn
-