org.springframework.cache.interceptor
Class LazyParamAwareEvaluationContext

java.lang.Object
  extended by org.springframework.expression.spel.support.StandardEvaluationContext
      extended by org.springframework.cache.interceptor.LazyParamAwareEvaluationContext
All Implemented Interfaces:
EvaluationContext

 class LazyParamAwareEvaluationContext
extends StandardEvaluationContext

Evaluation context class that adds a method parameters as SpEL variables, in a lazy manner. The lazy nature eliminates unneeded parsing of classes byte code for parameter discovery.

To limit the creation of objects, an ugly constructor is used (rather then a dedicated 'closure'-like class for deferred execution).

Since:
3.1
Author:
Costin Leau

Field Summary
private  java.lang.Object[] args
           
private  java.lang.reflect.Method method
           
private  java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodCache
           
private  ParameterNameDiscoverer paramDiscoverer
           
private  boolean paramLoaded
           
private  java.lang.Class<?> targetClass
           
 
Constructor Summary
LazyParamAwareEvaluationContext(java.lang.Object rootObject, ParameterNameDiscoverer paramDiscoverer, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Class<?> targetClass, java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodCache)
           
 
Method Summary
private  void loadArgsAsVariables()
           
 java.lang.Object lookupVariable(java.lang.String name)
          Load the param information only when needed.
 
Methods inherited from class org.springframework.expression.spel.support.StandardEvaluationContext
addConstructorResolver, addMethodResolver, addPropertyAccessor, getBeanResolver, getConstructorResolvers, getMethodResolvers, getOperatorOverloader, getPropertyAccessors, getRootObject, getTypeComparator, getTypeConverter, getTypeLocator, registerFunction, registerMethodFilter, removeConstructorResolver, removeMethodResolver, removePropertyAccessor, setBeanResolver, setConstructorResolvers, setMethodResolvers, setOperatorOverloader, setPropertyAccessors, setRootObject, setRootObject, setTypeComparator, setTypeConverter, setTypeLocator, setVariable, setVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paramDiscoverer

private final ParameterNameDiscoverer paramDiscoverer

method

private final java.lang.reflect.Method method

args

private final java.lang.Object[] args

targetClass

private final java.lang.Class<?> targetClass

methodCache

private final java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodCache

paramLoaded

private boolean paramLoaded
Constructor Detail

LazyParamAwareEvaluationContext

LazyParamAwareEvaluationContext(java.lang.Object rootObject,
                                ParameterNameDiscoverer paramDiscoverer,
                                java.lang.reflect.Method method,
                                java.lang.Object[] args,
                                java.lang.Class<?> targetClass,
                                java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> methodCache)
Method Detail

lookupVariable

public java.lang.Object lookupVariable(java.lang.String name)
Load the param information only when needed.

Specified by:
lookupVariable in interface EvaluationContext
Overrides:
lookupVariable in class StandardEvaluationContext
Parameters:
name - variable to lookup
Returns:
the value of the variable

loadArgsAsVariables

private void loadArgsAsVariables()