Top Description Fields Constructors Methods
org.springframework.expression.spel.ast

public Class CompoundExpression

extends SpelNodeImpl
Class Inheritance
Imports
java.util.function.Supplier, org.springframework.asm.MethodVisitor, org.springframework.expression.EvaluationException, .TypedValue, org.springframework.expression.spel.CodeFlow, .ExpressionState, .SpelEvaluationException, .SpelNode

Represents a DOT separated expression sequence, such as property1.property2.methodOne() or property1?.property2?.methodOne() when the null-safe navigation operator is used.

May also contain array/collection/map indexers, such as property1[0].property2['key'].

Authors
Andy Clement, Sam Brannen
Since
3.0

Field Summary

Inherited from org.springframework.expression.spel.ast.SpelNodeImpl:
childrenexitTypeDescriptor

Constructor Summary

AccessConstructor and Description
public
CompoundExpression(int startPos, int endPos, SpelNodeImpl... expressionComponents)

Method Summary

Modifier and TypeMethod and Description
public void
generateCode(MethodVisitor
the ASM MethodVisitor into which code should be generated
mv
,
CodeFlow
a context object with info about what is on the stack
cf
)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

Generate the bytecode for this node into the supplied visitor.
public TypedValue

Returns:

the final value from the last piece of the compound expression
getValueInternal
(ExpressionState
the state in which the expression is being evaluated
state
)

Implements abstract org.springframework.expression.spel.ast.SpelNodeImpl.getValueInternal.

Evaluates a compound expression.
protected ValueRef
public boolean
isCompilable()

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

Check whether a node can be compiled to bytecode.
public boolean
isWritable(ExpressionState
the current expression state (includes the context)
state
)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isWritable.

Implements org.springframework.expression.spel.SpelNode.isWritable.

Determine if this expression node will support a setValue() call.
public TypedValue
setValueInternal(ExpressionState
the current expression state (includes the context)
state
,
Supplier<TypedValue>
a supplier of the new value
valueSupplier
)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.setValueInternal.

Evaluate the expression to a node and then set the new value created by the specified Supplier on that node.
public String
toStringAST()

Implements org.springframework.expression.spel.SpelNode.toStringAST.

Return the string form of this AST node.
Inherited from org.springframework.expression.spel.ast.SpelNodeImpl:
generateCodeForArgumentgenerateCodeForArgumentsgetChildgetChildCountgetEndPositiongetExitDescriptorgetObjectClassgetStartPositiongetTypedValuegetValuegetValuenextChildIssetValue

Constructor Detail

CompoundExpressionback to summary
public CompoundExpression(int startPos, int endPos, SpelNodeImpl... expressionComponents)

Method Detail

generateCodeback to summary
public void generateCode(MethodVisitor mv, CodeFlow cf)

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

Doc from org.springframework.expression.spel.ast.SpelNodeImpl.generateCode.

Generate the bytecode for this node into the supplied visitor. Context info about the current expression being compiled is available in the codeflow object, e.g. including information about the type of the object currently on the stack.

Parameters
mv:MethodVisitor

the ASM MethodVisitor into which code should be generated

cf:CodeFlow

a context object with info about what is on the stack

Annotations
@Override
getValueInternalback to summary
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException

Implements abstract org.springframework.expression.spel.ast.SpelNodeImpl.getValueInternal.

Evaluates a compound expression. This involves evaluating each piece in turn and the return value from each piece is the active context object for the subsequent piece.

Parameters
state:ExpressionState

the state in which the expression is being evaluated

Returns:TypedValue

the final value from the last piece of the compound expression

Annotations
@Override
getValueRefback to summary
protected ValueRef getValueRef(ExpressionState state) throws EvaluationException

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.getValueRef.

Annotations
@Override
isCompilableback to summary
public boolean isCompilable()

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

Doc from org.springframework.expression.spel.ast.SpelNodeImpl.isCompilable.

Check whether a node can be compiled to bytecode. The reasoning in each node may be different but will typically involve checking whether the exit type descriptor of the node is known and any relevant child nodes are compilable.

Returns:boolean

true if this node can be compiled to bytecode

Annotations
@Override
isWritableback to summary
public boolean isWritable(ExpressionState state) throws EvaluationException

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.isWritable.

Implements org.springframework.expression.spel.SpelNode.isWritable.

Doc from org.springframework.expression.spel.SpelNode.isWritable.

Determine if this expression node will support a setValue() call.

Parameters
state:ExpressionState

the current expression state (includes the context)

Returns:boolean

true if the expression node will allow setValue()

Annotations
@Override
Exceptions
EvaluationException:
if something went wrong trying to determine if the node supports writing
setValueInternalback to summary
public TypedValue setValueInternal(ExpressionState state, Supplier<TypedValue> valueSupplier) throws EvaluationException

Overrides org.springframework.expression.spel.ast.SpelNodeImpl.setValueInternal.

Doc from org.springframework.expression.spel.ast.SpelNodeImpl.setValueInternal.

Evaluate the expression to a node and then set the new value created by the specified Supplier on that node.

For example, if the expression evaluates to a property reference, then the property will be set to the new value.

Favor this method over setValue(ExpressionState, Object) when the value should be lazily computed.

By default, this method throws a SpelEvaluationException, effectively disabling this feature. Subclasses may override this method to provide an actual implementation.

Parameters
state:ExpressionState

the current expression state (includes the context)

valueSupplier:Supplier<TypedValue>

a supplier of the new value

Annotations
@Override
Exceptions
EvaluationException:
if any problem occurs evaluating the expression or setting the new value
toStringASTback to summary
public String toStringAST()

Implements org.springframework.expression.spel.SpelNode.toStringAST.

Doc from org.springframework.expression.spel.SpelNode.toStringAST.

Return the string form of this AST node.

Returns:String

the string form

Annotations
@Override