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.
| Modifier and Type | Field and Description |
|---|---|
| private final SpelNodeImpl | |
| private volatile CompiledExpression | |
| private final SpelParserConfiguration | |
| private EvaluationContext | |
| private final String | |
| private static final int | |
| private final AtomicInteger | |
| private static final int | |
| private final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| public | SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration)
Construct an expression, only used by the parser. |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkCompile(ExpressionState
the expression state used to determine compilation mode expressionState)Compile the expression if it has been evaluated more than the threshold number of times to trigger compilation. |
| public boolean | Returns: whether this expression has been successfully compiledPerform expression compilation. |
| public SpelNode | |
| public EvaluationContext | Returns: the default evaluation contextReturn the default evaluation context that will be used if none is supplied on an evaluation call. |
| public String | getExpressionString()
Implements org. Return the original string used to create this expression (unmodified). |
| public Object | getValue()
Implements org. Evaluate this expression in the default standard context. |
| public <T> T | getValue(Class<T>
the type the caller would like the result to be expectedResultType)Implements org. Evaluate this expression in the default context. |
| public Object | getValue(Object
the root object against which to evaluate the expression rootObject)Implements org. Evaluate this expression against the specified root object. |
| public <T> T | getValue(Object
the root object against which to evaluate the expression rootObject, Class<T> the type the caller would like the result to be expectedResultType)Implements org. Evaluate this expression in the default context against the specified root object. |
| public Object | getValue(EvaluationContext
the context in which to evaluate the expression context)Implements org. Evaluate this expression in the provided context and return the result of evaluation. |
| public <T> T | getValue(EvaluationContext
the context in which to evaluate the expression context, Class<T> the type the caller would like the result to be expectedResultType)Implements org. Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type. |
| public Object | getValue(EvaluationContext
the context in which to evaluate the expression context, Object the root object against which to evaluate the expression rootObject)Implements org. Evaluate this expression in the provided context and return the result of evaluation, but use the supplied root context as an override for any default root object specified in the context. |
| public <T> T | getValue(EvaluationContext
the context in which to evaluate the expression context, Object the root object against which to evaluate the expression rootObject, Class<T> the type the caller would like the result to be expectedResultType)Implements org. Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type.j The supplied root object overrides any specified in the supplied context. |
| public Class | getValueType()
Implements org. Return the most general type that can be passed to the
|
| public Class | getValueType(Object
the root object against which to evaluate the expression rootObject)Implements org. Return the most general type that can be passed to the
|
| public Class | getValueType(EvaluationContext
the context in which to evaluate the expression context)Implements org. Return the most general type that can be passed to the
|
| public Class | getValueType(EvaluationContext
the context in which to evaluate the expression context, Object the root object against which to evaluate the expression rootObject)Implements org. Return the most general type that can be passed to the
|
| public TypeDescriptor | getValueTypeDescriptor()
Implements org. Return a descriptor for the most general type that can be passed to one of
the |
| public TypeDescriptor | getValueTypeDescriptor(Object
the root object against which to evaluate the expression rootObject)Implements org. Return a descriptor for the most general type that can be passed to the
|
| public TypeDescriptor | getValueTypeDescriptor(EvaluationContext
the context in which to evaluate the expression context)Implements org. Return a descriptor for the most general type that can be passed to the
|
| public TypeDescriptor | getValueTypeDescriptor(EvaluationContext
the context in which to evaluate the expression context, Object the root object against which to evaluate the expression rootObject)Implements org. Return a descriptor for the most general type that can be passed to the
|
| public boolean | isWritable(Object
the root object against which to evaluate the expression rootObject)Implements org. Determine if this expression can be written to, i.e. setValue() can be called. |
| public boolean | isWritable(EvaluationContext
the context in which the expression should be checked context)Implements org. Determine if this expression can be written to, i.e. setValue() can be called. |
| public boolean | isWritable(EvaluationContext
the context in which the expression should be checked context, Object the root object against which to evaluate the expression rootObject)Implements org. Determine if this expression can be written to, i.e. setValue() can be called. |
| public void | revertToInterpreted()
Cause an expression to revert to being interpreted if it has been using a compiled form. |
| public void | setEvaluationContext(EvaluationContext
the evaluation context to use evaluationContext)Set the evaluation context that will be used if none is specified on an evaluation call. |
| public void | setValue(Object
the root object against which to evaluate the expression rootObject, Object the new value value)Implements org. Set this expression in the provided context to the value provided. |
| public void | setValue(EvaluationContext
the context in which to set the value of the expression context, Object the new value value)Implements org. Set this expression in the provided context to the value provided. |
| public void | setValue(EvaluationContext
the context in which to set the value of the expression context, Object the root object against which to evaluate the expression rootObject, Object the new value value)Implements org. Set this expression in the provided context to the value provided. |
| public String | Returns: the string representation of the ASTProduce a string representation of the Abstract Syntax Tree for the expression. |
| private TypedValue |
| ast | back to summary |
|---|---|
| private final SpelNodeImpl ast | |
| compiledAst | back to summary |
|---|---|
| private volatile CompiledExpression compiledAst
| |
| configuration | back to summary |
|---|---|
| private final SpelParserConfiguration configuration | |
| evaluationContext | back to summary |
|---|---|
| private EvaluationContext evaluationContext
| |
| expression | back to summary |
|---|---|
| private final String expression | |
| FAILED_ATTEMPTS_THRESHOLD | back to summary |
|---|---|
| private static final int FAILED_ATTEMPTS_THRESHOLD | |
| failedAttempts | back to summary |
|---|---|
| private final AtomicInteger failedAttempts | |
| INTERPRETED_COUNT_THRESHOLD | back to summary |
|---|---|
| private static final int INTERPRETED_COUNT_THRESHOLD | |
| interpretedCount | back to summary |
|---|---|
| private final AtomicInteger interpretedCount | |
| SpelExpression | back to summary |
|---|---|
| public SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration) Construct an expression, only used by the parser. | |
| checkCompile | back to summary |
|---|---|
| private void checkCompile(ExpressionState expressionState) Compile the expression if it has been evaluated more than the threshold number of times to trigger compilation.
| |
| compileExpression | back to summary |
|---|---|
| public boolean compileExpression() 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 | back to summary |
|---|---|
| public SpelNode getAST() Return the Abstract Syntax Tree for the expression. | |
| getEvaluationContext | back to summary |
|---|---|
| public EvaluationContext getEvaluationContext() Return the default evaluation context that will be used if none is supplied on an evaluation call.
| |
| getExpressionString | back to summary |
|---|---|
| public String getExpressionString() Implements org. Doc from org. Return the original string used to create this expression (unmodified). | |
| getValue | back to summary |
|---|---|
| public Object getValue() throws EvaluationException Implements org. Doc from org. Evaluate this expression in the default standard context.
| |
| getValue | back to summary |
|---|---|
| public <T> T getValue(Class<T> expectedResultType) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the default context. If the result of the evaluation does not match (and cannot be converted to) the expected result type then an exception will be thrown.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(Object rootObject) throws EvaluationException Implements org. Doc from org. Evaluate this expression against the specified root object.
| |
| getValue | back to summary |
|---|---|
| public <T> T getValue(Object rootObject, Class<T> expectedResultType) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the default context against the specified root object. If the result of the evaluation does not match (and cannot be converted to) the expected result type then an exception will be thrown.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(EvaluationContext context) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the provided context and return the result of evaluation.
| |
| getValue | back to summary |
|---|---|
| public <T> T getValue(EvaluationContext context, Class<T> expectedResultType) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the provided context and return the result of evaluation, but use the supplied root context as an override for any default root object specified in the context.
| |
| getValue | back to summary |
|---|---|
| public <T> T getValue(EvaluationContext context, Object rootObject, Class<T> expectedResultType) throws EvaluationException Implements org. Doc from org. Evaluate this expression in the provided context which can resolve references to properties, methods, types, etc. The type of the evaluation result is expected to be of a particular type, and an exception will be thrown if it is not and cannot be converted to that type.j The supplied root object overrides any specified in the supplied context.
| |
| getValueType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return the most general type that can be passed to the
| |
| getValueType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return the most general type that can be passed to the
| |
| getValueType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return the most general type that can be passed to the
| |
| getValueType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Return the most general type that can be passed to the
The supplied root object overrides any specified in the supplied context.
| |
| getValueTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor getValueTypeDescriptor() throws EvaluationException Implements org. Doc from org. Return a descriptor for the most general type that can be passed to one of
the
| |
| getValueTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException Implements org. Doc from org. Return a descriptor for the most general type that can be passed to the
| |
| getValueTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException Implements org. Doc from org. Return a descriptor for the most general type that can be passed to the
| |
| getValueTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException Implements org. Doc from org. Return a descriptor for the most general type that can be passed to the
The supplied root object overrides any specified in the supplied context.
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable(Object rootObject) throws EvaluationException Implements org. Doc from org. Determine if this expression can be written to, i.e. setValue() can be called.
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable(EvaluationContext context) throws EvaluationException Implements org. Doc from org. Determine if this expression can be written to, i.e. setValue() can be called.
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException Implements org. Doc from org. Determine if this expression can be written to, i.e. setValue() can be called. The supplied root object overrides any specified in the supplied context.
| |
| revertToInterpreted | back to summary |
|---|---|
| public void revertToInterpreted() 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 | back to summary |
|---|---|
| public void setEvaluationContext(EvaluationContext evaluationContext) Set the evaluation context that will be used if none is specified on an evaluation call.
| |
| setValue | back to summary |
|---|---|
| public void setValue(Object rootObject, Object value) throws EvaluationException Implements org. Doc from org. Set this expression in the provided context to the value provided.
| |
| setValue | back to summary |
|---|---|
| public void setValue(EvaluationContext context, Object value) throws EvaluationException Implements org. Doc from org. Set this expression in the provided context to the value provided.
| |
| setValue | back to summary |
|---|---|
| public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException Implements org. Doc from org. Set this expression in the provided context to the value provided. The supplied root object overrides any specified in the supplied context.
| |
| toStringAST | back to summary |
|---|---|
| public String toStringAST() 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.
| |
| toTypedValue | back to summary |
|---|---|
| private TypedValue toTypedValue(Object object) | |