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

public Class VariableReference

extends SpelNodeImpl
Class Inheritance
Imports
java.lang.reflect.Modifier, java.util.function.Supplier, org.springframework.asm.MethodVisitor, org.springframework.expression.EvaluationContext, .EvaluationException, .TypedValue, org.springframework.expression.spel.CodeFlow, .ExpressionState, .SpelEvaluationException, org.springframework.lang.Nullable

Represents a variable reference — for example, #someVar.
Authors
Andy Clement, Sam Brannen
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final String
private static final String
private static final String
Inherited from org.springframework.expression.spel.ast.SpelNodeImpl:
childrenexitTypeDescriptor

Constructor Summary

AccessConstructor and Description
public
VariableReference(String variableName, int startPos, int endPos)

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
public 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)
expressionState
)

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

Field Detail

nameback to summary
private final String name
ROOTback to summary
private static final String ROOT
THISback to summary
private static final String THIS

Constructor Detail

VariableReferenceback to summary
public VariableReference(String variableName, int startPos, int endPos)

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 SpelEvaluationException

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

Annotations
@Override
getValueRefback to summary
public ValueRef getValueRef(ExpressionState state) throws SpelEvaluationException

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 expressionState) throws SpelEvaluationException

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
expressionState:ExpressionState

the current expression state (includes the context)

Returns:boolean

true if the expression node will allow setValue()

Annotations
@Override
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
org.springframework.expression.spel.ast back to summary

private Class VariableReference.VariableRef

extends Object
implements ValueRef
Class Inheritance
  • java.lang.Object
  • org.springframework.expression.spel.ast.VariableReference.VariableRef
All Implemented Interfaces
org.springframework.expression.spel.ast.ValueRef

Field Summary

Modifier and TypeField and Description
private final EvaluationContext
private final String
private final TypedValue

Constructor Summary

AccessConstructor and Description
public
VariableRef(String name, TypedValue value, EvaluationContext evaluationContext)

Method Summary

Modifier and TypeMethod and Description
public TypedValue
getValue()

Implements org.springframework.expression.spel.ast.ValueRef.getValue.

Returns the value this ValueRef points to, it should not require expression component re-evaluation.
public boolean
isWritable()

Implements org.springframework.expression.spel.ast.ValueRef.isWritable.

Indicates whether calling setValue(Object) is supported.
public void
setValue(Object
the new value
newValue
)

Implements org.springframework.expression.spel.ast.ValueRef.setValue.

Sets the value this ValueRef points to, it should not require expression component re-evaluation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

evaluationContextback to summary
private final EvaluationContext evaluationContext
nameback to summary
private final String name
valueback to summary
private final TypedValue value

Constructor Detail

VariableRefback to summary
public VariableRef(String name, TypedValue value, EvaluationContext evaluationContext)

Method Detail

getValueback to summary
public TypedValue getValue()

Implements org.springframework.expression.spel.ast.ValueRef.getValue.

Doc from org.springframework.expression.spel.ast.ValueRef.getValue.

Returns the value this ValueRef points to, it should not require expression component re-evaluation.

Returns:TypedValue

the value

Annotations
@Override
isWritableback to summary
public boolean isWritable()

Implements org.springframework.expression.spel.ast.ValueRef.isWritable.

Doc from org.springframework.expression.spel.ast.ValueRef.isWritable.

Indicates whether calling setValue(Object) is supported.

Returns:boolean

true if setValue() is supported for this value reference.

Annotations
@Override
setValueback to summary
public void setValue(Object newValue)

Implements org.springframework.expression.spel.ast.ValueRef.setValue.

Doc from org.springframework.expression.spel.ast.ValueRef.setValue.

Sets the value this ValueRef points to, it should not require expression component re-evaluation.

Parameters
newValue:Object

the new value

Annotations
@Override