|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.expression.common.LiteralExpression
public class LiteralExpression
A very simple hardcoded implementation of the Expression interface that represents a string literal. It is used with CompositeStringExpression when representing a template expression which is made up of pieces - some being real expressions to be handled by an EL implementation like Spel, and some being just textual elements.
Constructor Summary | |
---|---|
LiteralExpression(String literalValue)
|
Method Summary | ||
---|---|---|
String |
getExpressionString()
Returns the original string used to create this expression, unmodified. |
|
String |
getValue()
Evaluate this expression in the default standard context. |
|
|
getValue(Class<T> expectedResultType)
Evaluate the expression in the default context. |
|
String |
getValue(EvaluationContext context)
Evaluate this expression in the provided context and return the result of evaluation. |
|
|
getValue(EvaluationContext context,
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. |
|
String |
getValue(EvaluationContext context,
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,
Object rootObject,
Class<T> desiredResultType)
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. |
|
String |
getValue(Object rootObject)
Evaluate this expression against the specified root object |
|
|
getValue(Object rootObject,
Class<T> desiredResultType)
Evaluate the expression in the default context against the specified root object. |
|
Class |
getValueType()
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method using the default context. |
|
Class |
getValueType(EvaluationContext context)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method for the given context. |
|
Class |
getValueType(EvaluationContext context,
Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object)
method for the given context. |
|
Class |
getValueType(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,
Object rootObject)
Returns the most general type that can be passed to the Expression.setValue(EvaluationContext, Object) method for
the given context. |
|
TypeDescriptor |
getValueTypeDescriptor(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,
Object rootObject)
Determine if an expression can be written to, i.e. |
|
boolean |
isWritable(Object rootObject)
Determine if an expression can be written to, i.e. |
|
void |
setValue(EvaluationContext context,
Object value)
Set this expression in the provided context to the value provided. |
|
void |
setValue(EvaluationContext context,
Object rootObject,
Object value)
Set this expression in the provided context to the value provided. |
|
void |
setValue(Object rootObject,
Object value)
Set this expression in the provided context to the value provided. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LiteralExpression(String literalValue)
Method Detail |
---|
public final String getExpressionString()
Expression
getExpressionString
in interface Expression
public String getValue()
Expression
getValue
in interface Expression
public String getValue(EvaluationContext context)
Expression
getValue
in interface Expression
context
- the context in which to evaluate the expression
public String getValue(Object rootObject)
Expression
getValue
in interface Expression
rootObject
- the root object against which properties/etc will be resolved
public Class getValueType(EvaluationContext context)
Expression
Expression.setValue(EvaluationContext, Object)
method for the given context.
getValueType
in interface Expression
context
- the context in which to evaluate the expression
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context)
Expression
Expression.setValue(EvaluationContext, Object)
method for the given context.
getValueTypeDescriptor
in interface Expression
context
- the context in which to evaluate the expression
public TypeDescriptor getValueTypeDescriptor()
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueTypeDescriptor
in interface Expression
public void setValue(EvaluationContext context, 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 <T> T getValue(EvaluationContext context, 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(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 boolean isWritable(EvaluationContext context)
Expression
isWritable
in interface Expression
context
- the context in which the expression should be checked
public Class getValueType()
Expression
Expression.setValue(EvaluationContext, Object)
method using the default context.
getValueType
in interface Expression
public <T> T getValue(Object rootObject, Class<T> desiredResultType) throws EvaluationException
Expression
getValue
in interface Expression
rootObject
- the root object against which properties/etc will be resolveddesiredResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic String getValue(EvaluationContext context, 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, Object rootObject, Class<T> desiredResultType) 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 resolveddesiredResultType
- the class the caller would like the result to be
EvaluationException
- if there is a problem during evaluationpublic Class getValueType(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 Class getValueType(EvaluationContext context, 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(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, 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 boolean isWritable(EvaluationContext context, 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, Object rootObject, 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 boolean isWritable(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 void setValue(Object rootObject, 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 evaluation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |