|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.expression.spel.standard.SpelExpression
public class SpelExpression
A SpelExpressions 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, methods.
Field Summary | |
---|---|
private SpelNodeImpl |
ast
|
private SpelParserConfiguration |
configuration
|
private EvaluationContext |
defaultContext
|
private java.lang.String |
expression
|
Constructor Summary | |
---|---|
SpelExpression(java.lang.String expression,
SpelNodeImpl ast,
SpelParserConfiguration configuration)
Construct an expression, only used by the parser. |
Method Summary | ||
---|---|---|
SpelNode |
getAST()
|
|
EvaluationContext |
getEvaluationContext()
Return the default evaluation context that will be used if none is supplied on an evaluation call |
|
java.lang.String |
getExpressionString()
Returns the original string used to create this expression, unmodified. |
|
java.lang.Object |
getValue()
Evaluate this expression in the default standard context. |
|
|
getValue(java.lang.Class<T> expectedResultType)
Evaluate the expression in the default context. |
|
java.lang.Object |
getValue(EvaluationContext context)
Evaluate this expression in the provided context and return the result of evaluation. |
|
|
getValue(EvaluationContext context,
java.lang.Class<T> expectedResultType)
Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc - the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it is not and cannot be converted to that type. |
|
java.lang.Object |
getValue(EvaluationContext context,
java.lang.Object rootObject)
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(EvaluationContext context,
java.lang.Object rootObject,
java.lang.Class<T> expectedResultType)
Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc - the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it is not and cannot be converted to that type. |
|
java.lang.Object |
getValue(java.lang.Object rootObject)
Evaluate this expression against the specified root object |
|
|
getValue(java.lang.Object rootObject,
java.lang.Class<T> expectedResultType)
Evaluate the expression in the default context against the specified root object. |
|
java.lang.Class |
getValueType()
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method using the default context. |
|
java.lang.Class |
getValueType(EvaluationContext context)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method for the given context. |
|
java.lang.Class |
getValueType(EvaluationContext context,
java.lang.Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method for the given context. |
|
java.lang.Class |
getValueType(java.lang.Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method using the default context. |
|
TypeDescriptor |
getValueTypeDescriptor()
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method using the default context. |
|
TypeDescriptor |
getValueTypeDescriptor(EvaluationContext context)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method for the given context. |
|
TypeDescriptor |
getValueTypeDescriptor(EvaluationContext context,
java.lang.Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object) method for
the given context. |
|
TypeDescriptor |
getValueTypeDescriptor(java.lang.Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method using the default context. |
|
boolean |
isWritable(EvaluationContext context)
Determine if an expression can be written to, i.e. |
|
boolean |
isWritable(EvaluationContext context,
java.lang.Object rootObject)
Determine if an expression can be written to, i.e. |
|
boolean |
isWritable(java.lang.Object rootObject)
Determine if an expression can be written to, i.e. |
|
void |
setEvaluationContext(EvaluationContext context)
Set the evaluation context that will be used if none is specified on an evaluation call. |
|
void |
setValue(EvaluationContext context,
java.lang.Object value)
Set this expression in the provided context to the value provided. |
|
void |
setValue(EvaluationContext context,
java.lang.Object rootObject,
java.lang.Object value)
Set this expression in the provided context to the value provided. |
|
void |
setValue(java.lang.Object rootObject,
java.lang.Object value)
Set this expression in the provided context to the value provided. |
|
java.lang.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. |
|
private TypedValue |
toTypedValue(java.lang.Object object)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String expression
private final SpelNodeImpl ast
private final SpelParserConfiguration configuration
private EvaluationContext defaultContext
Constructor Detail |
---|
public SpelExpression(java.lang.String expression, SpelNodeImpl ast, SpelParserConfiguration configuration)
Method Detail |
---|
public java.lang.Object getValue() throws EvaluationException
Expression
getValue
in interface Expression
EvaluationException
- if there is a problem during evaluationpublic java.lang.Object getValue(java.lang.Object rootObject) throws EvaluationException
Expression
getValue
in interface Expression
rootObject
- the root object against which properties/etc will be resolved
EvaluationException
- if there is a problem during evaluationpublic <T> T getValue(java.lang.Class<T> expectedResultType) throws EvaluationException
Expression
getValue
in interface Expression
expectedResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic <T> T getValue(java.lang.Object rootObject, java.lang.Class<T> expectedResultType) throws EvaluationException
Expression
getValue
in interface Expression
rootObject
- the root object against which properties/etc will be resolvedexpectedResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic java.lang.Object getValue(EvaluationContext context) throws EvaluationException
Expression
getValue
in interface Expression
context
- the context in which to evaluate the expression
EvaluationException
- if there is a problem during evaluationpublic java.lang.Object getValue(EvaluationContext context, java.lang.Object rootObject) throws EvaluationException
Expression
getValue
in interface Expression
context
- the context in which to evaluate the expressionrootObject
- the root object against which properties/etc will be resolved
EvaluationException
- if there is a problem during evaluationpublic <T> T getValue(EvaluationContext context, java.lang.Class<T> expectedResultType) throws EvaluationException
Expression
getValue
in interface Expression
context
- the context in which to evaluate the expressionexpectedResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic <T> T getValue(EvaluationContext context, java.lang.Object rootObject, java.lang.Class<T> expectedResultType) throws EvaluationException
Expression
getValue
in interface Expression
context
- the context in which to evaluate the expressionrootObject
- the root object against which properties/etc will be resolvedexpectedResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic java.lang.Class getValueType() throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueType
in interface Expression
EvaluationException
- if there is a problem determining the typepublic java.lang.Class getValueType(java.lang.Object rootObject) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueType
in interface Expression
rootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic java.lang.Class getValueType(EvaluationContext context) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method for the given context.
getValueType
in interface Expression
context
- the context in which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic java.lang.Class getValueType(EvaluationContext context, java.lang.Object rootObject) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method for the given context. The supplied root object overrides any specified in the context.
getValueType
in interface Expression
context
- the context in which to evaluate the expressionrootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic TypeDescriptor getValueTypeDescriptor() throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueTypeDescriptor
in interface Expression
EvaluationException
- if there is a problem determining the typepublic TypeDescriptor getValueTypeDescriptor(java.lang.Object rootObject) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueTypeDescriptor
in interface Expression
rootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method for the given context.
getValueTypeDescriptor
in interface Expression
context
- the context in which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic TypeDescriptor getValueTypeDescriptor(EvaluationContext context, java.lang.Object rootObject) throws EvaluationException
Expression
Expression.setValue(EvaluationContext, Object)
method for
the given context. The supplied root object overrides any specified in the context.
getValueTypeDescriptor
in interface Expression
context
- the context in which to evaluate the expressionrootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining the typepublic java.lang.String getExpressionString()
Expression
getExpressionString
in interface Expression
public boolean isWritable(EvaluationContext context) throws EvaluationException
Expression
isWritable
in interface Expression
context
- the context in which the expression should be checked
EvaluationException
- if there is a problem determining if it is writablepublic boolean isWritable(java.lang.Object rootObject) throws EvaluationException
Expression
isWritable
in interface Expression
rootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining if it is writablepublic boolean isWritable(EvaluationContext context, java.lang.Object rootObject) throws EvaluationException
Expression
isWritable
in interface Expression
context
- the context in which the expression should be checkedrootObject
- the root object against which to evaluate the expression
EvaluationException
- if there is a problem determining if it is writablepublic void setValue(EvaluationContext context, java.lang.Object value) throws EvaluationException
Expression
setValue
in interface Expression
context
- the context in which to set the value of the expressionvalue
- the new value
EvaluationException
- if there is a problem during evaluationpublic void setValue(java.lang.Object rootObject, java.lang.Object value) throws EvaluationException
Expression
setValue
in interface Expression
rootObject
- the root object against which to evaluate the expressionvalue
- the new value
EvaluationException
- if there is a problem during evaluationpublic void setValue(EvaluationContext context, java.lang.Object rootObject, java.lang.Object value) throws EvaluationException
Expression
setValue
in interface Expression
context
- the context in which to set the value of the expressionrootObject
- the root object against which to evaluate the expressionvalue
- the new value
EvaluationException
- if there is a problem during evaluationpublic SpelNode getAST()
public java.lang.String toStringAST()
public EvaluationContext getEvaluationContext()
public void setEvaluationContext(EvaluationContext context)
context
- an evaluation contextprivate TypedValue toTypedValue(java.lang.Object object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |