spring-framework / org.springframework.expression.spel.standard / SpelExpression

SpelExpression

open class SpelExpression : Expression

A SpelExpression represents a parsed (valid) expression that is ready to be evaluated in a specified context. An expression can be evaluated standalone or in a specified context. During expression evaluation the context may be asked to resolve references to types, beans, properties, and methods.

Author
Andy Clement

Author
Juergen Hoeller

Since
3.0

Constructors

<init>

SpelExpression(expression: String, ast: SpelNodeImpl, configuration: SpelParserConfiguration)

Construct an expression, only used by the parser.

Functions

compileExpression

open fun compileExpression(): Boolean

Perform expression compilation. This will only succeed once exit descriptors for all nodes have been determined. If the compilation fails and has failed more than 100 times the expression is no longer considered suitable for compilation.

getAST

open fun getAST(): SpelNode

Return the Abstract Syntax Tree for the expression.

getEvaluationContext

open fun getEvaluationContext(): EvaluationContext

Return the default evaluation context that will be used if none is supplied on an evaluation call.

getExpressionString

open fun getExpressionString(): String

getValue

open fun getValue(): Any
open fun <T : Any> getValue(expectedResultType: Class<T>): T
open fun getValue(rootObject: Any): Any
open fun <T : Any> getValue(rootObject: Any, expectedResultType: Class<T>): T
open fun getValue(context: EvaluationContext): Any
open fun <T : Any> getValue(context: EvaluationContext, expectedResultType: Class<T>): T
open fun getValue(context: EvaluationContext, rootObject: Any): Any
open fun <T : Any> getValue(context: EvaluationContext, rootObject: Any, expectedResultType: Class<T>): T

getValueType

open fun getValueType(): Class<*>
open fun getValueType(rootObject: Any): Class<*>
open fun getValueType(context: EvaluationContext): Class<*>
open fun getValueType(context: EvaluationContext, rootObject: Any): Class<*>

getValueTypeDescriptor

open fun getValueTypeDescriptor(): TypeDescriptor
open fun getValueTypeDescriptor(rootObject: Any): TypeDescriptor
open fun getValueTypeDescriptor(context: EvaluationContext): TypeDescriptor
open fun getValueTypeDescriptor(context: EvaluationContext, rootObject: Any): TypeDescriptor

isWritable

open fun isWritable(rootObject: Any): Boolean
open fun isWritable(context: EvaluationContext): Boolean
open fun isWritable(context: EvaluationContext, rootObject: Any): Boolean

revertToInterpreted

open fun revertToInterpreted(): Unit

Cause an expression to revert to being interpreted if it has been using a compiled form. It also resets the compilation attempt failure count (an expression is normally no longer considered compilable if it cannot be compiled after 100 attempts).

setEvaluationContext

open fun setEvaluationContext(evaluationContext: EvaluationContext): Unit

Set the evaluation context that will be used if none is specified on an evaluation call.

setValue

open fun setValue(rootObject: Any, value: Any): Unit
open fun setValue(context: EvaluationContext, value: Any): Unit
open fun setValue(context: EvaluationContext, rootObject: Any, value: Any): Unit

toStringAST

open fun toStringAST(): String

Produce a string representation of the Abstract Syntax Tree for the expression. This should ideally look like the input expression, but properly formatted since any unnecessary whitespace will have been discarded during the parse of the expression.