org.springframework.context.expression
Class AbstractBeanExpressionResolver

java.lang.Object
  extended by org.springframework.context.expression.AbstractBeanExpressionResolver
All Implemented Interfaces:
BeanExpressionResolver
Direct Known Subclasses:
StandardBeanExpressionResolver

public abstract class AbstractBeanExpressionResolver
extends java.lang.Object
implements BeanExpressionResolver

Abstract implementation of the BeanExpressionResolver interface. Handles the common mixing of expression parts with literal parts.

Subclasses need to implement the evaluateExpression(java.lang.String, org.springframework.beans.factory.config.BeanExpressionContext) template method for actual expression evaluation.

Since:
3.0
Author:
Juergen Hoeller
See Also:
setExpressionPrefix(java.lang.String), setExpressionSuffix(java.lang.String)

Field Summary
static java.lang.String DEFAULT_EXPRESSION_PREFIX
          Default expression prefix: "#{"
static java.lang.String DEFAULT_EXPRESSION_SUFFIX
          Default expression suffix: "}"
 
Constructor Summary
AbstractBeanExpressionResolver()
           
 
Method Summary
 java.lang.Object evaluate(java.lang.String value, BeanExpressionContext evalContext)
          Evaluate the given value as an expression, if applicable; return the value as-is otherwise.
protected abstract  java.lang.Object evaluateExpression(java.lang.String exprString, BeanExpressionContext evalContext)
          Evaluate the given expression.
 void setExpressionPrefix(java.lang.String expressionPrefix)
          Set the prefix that an expression string starts with.
 void setExpressionSuffix(java.lang.String expressionSuffix)
          Set the suffix that an expression string ends with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXPRESSION_PREFIX

public static final java.lang.String DEFAULT_EXPRESSION_PREFIX
Default expression prefix: "#{"

See Also:
Constant Field Values

DEFAULT_EXPRESSION_SUFFIX

public static final java.lang.String DEFAULT_EXPRESSION_SUFFIX
Default expression suffix: "}"

See Also:
Constant Field Values
Constructor Detail

AbstractBeanExpressionResolver

public AbstractBeanExpressionResolver()
Method Detail

setExpressionPrefix

public void setExpressionPrefix(java.lang.String expressionPrefix)
Set the prefix that an expression string starts with. The default is "#{".

See Also:
DEFAULT_EXPRESSION_PREFIX

setExpressionSuffix

public void setExpressionSuffix(java.lang.String expressionSuffix)
Set the suffix that an expression string ends with. The default is "}".

See Also:
DEFAULT_EXPRESSION_SUFFIX

evaluate

public java.lang.Object evaluate(java.lang.String value,
                                 BeanExpressionContext evalContext)
Description copied from interface: BeanExpressionResolver
Evaluate the given value as an expression, if applicable; return the value as-is otherwise.

Specified by:
evaluate in interface BeanExpressionResolver
Parameters:
value - the value to check
evalContext - the evaluation context
Returns:
the resolved value (potentially the given value as-is)

evaluateExpression

protected abstract java.lang.Object evaluateExpression(java.lang.String exprString,
                                                       BeanExpressionContext evalContext)
Evaluate the given expression.

Parameters:
exprString - the expression String to evaluate
evalContext - the context to evaluate the expression within
Returns:
the evaluation result