Top Description Methods
org.springframework.expression.spel

public Interface SpelNode

Known Direct Implementers
org.springframework.expression.spel.ast.SpelNodeImpl
Imports
org.springframework.expression.EvaluationException, .TypedValue, org.springframework.lang.Nullable

Represents a node in the AST for a parsed expression.
Author
Andy Clement
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public SpelNode

Returns:

the child node cast to a SpelNode
getChild
(int index)

Helper method that returns a SpelNode rather than an Antlr Tree node.

public int

Returns:

the child count
getChildCount
()

Return the number of children under this node.

public int

Returns:

the end position
getEndPosition
()

Return the end position of this AST node in the expression string.

public Class<?>

Returns:

the class of the object if it is not already a class object, or null if the object is null
getObjectClass
(Object
the object that the caller wants the class of
obj
)

Determine the class of the object passed in, unless it is already a class object.

public int

Returns:

the start position
getStartPosition
()

Return the start position of this AST node in the expression string.

public TypedValue

Returns:

the type value of this node evaluated against the specified state
getTypedValue
(ExpressionState
the current expression state (includes the context)
expressionState
)

Evaluate the expression node in the context of the supplied expression state and return the typed value.

public Object

Returns:

the value of this node evaluated against the specified state
getValue
(ExpressionState
the current expression state (includes the context)
expressionState
)

Evaluate the expression node in the context of the supplied expression state and return the value.

public boolean

Returns:

true if the expression node will allow setValue()
isWritable
(ExpressionState
the current expression state (includes the context)
expressionState
)

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

public void
setValue(ExpressionState
the current expression state (includes the context)
expressionState
,
Object
the new value
newValue
)

Evaluate the expression to a node and then set the new value on that node.

public String

Returns:

the string form
toStringAST
()

Return the string form of this AST node.

Method Detail

getChildback to summary
public SpelNode getChild(int index)

Helper method that returns a SpelNode rather than an Antlr Tree node.

Returns:SpelNode

the child node cast to a SpelNode

getChildCountback to summary
public int getChildCount()

Return the number of children under this node.

Returns:int

the child count

getEndPositionback to summary
public int getEndPosition()

Return the end position of this AST node in the expression string.

Returns:int

the end position

getObjectClassback to summary
public Class<?> getObjectClass(Object obj)

Determine the class of the object passed in, unless it is already a class object.

Parameters
obj:Object

the object that the caller wants the class of

Returns:Class<?>

the class of the object if it is not already a class object, or null if the object is null

Annotations
@Nullable
getStartPositionback to summary
public int getStartPosition()

Return the start position of this AST node in the expression string.

Returns:int

the start position

getTypedValueback to summary
public TypedValue getTypedValue(ExpressionState expressionState) throws EvaluationException

Evaluate the expression node in the context of the supplied expression state and return the typed value.

Parameters
expressionState:ExpressionState

the current expression state (includes the context)

Returns:TypedValue

the type value of this node evaluated against the specified state

getValueback to summary
public Object getValue(ExpressionState expressionState) throws EvaluationException

Evaluate the expression node in the context of the supplied expression state and return the value.

Parameters
expressionState:ExpressionState

the current expression state (includes the context)

Returns:Object

the value of this node evaluated against the specified state

Annotations
@Nullable
isWritableback to summary
public boolean isWritable(ExpressionState expressionState) throws EvaluationException

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()

Exceptions
EvaluationException:
if something went wrong trying to determine if the node supports writing
setValueback to summary
public void setValue(ExpressionState expressionState, Object newValue) throws EvaluationException

Evaluate the expression to a node and then set the new value on that node. For example, if the expression evaluates to a property reference, then the property will be set to the new value.

Parameters
expressionState:ExpressionState

the current expression state (includes the context)

newValue:Object

the new value

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

Return the string form of this AST node.

Returns:String

the string form