Class MethodBasedEvaluationContext
- java.lang.Object
- org.springframework.expression.spel.support.StandardEvaluationContext
- org.springframework.context.expression.MethodBasedEvaluationContext
- All Implemented Interfaces:
EvaluationContext
public class MethodBasedEvaluationContext extends StandardEvaluationContext
A method-basedEvaluationContextthat provides explicit support for method-based invocations.Expose the actual method arguments using the following aliases:
- pX where X is the index of the argument (p0 for the first argument)
- aX where X is the index of the argument (a1 for the second argument)
- the name of the parameter as discovered by a configurable
ParameterNameDiscoverer
- Since:
- 4.2
- Author:
- Stephane Nicoll, Juergen Hoeller
Constructor Summary
Constructors Constructor Description MethodBasedEvaluationContext(Object rootObject, Method method, Object[] arguments, ParameterNameDiscoverer parameterNameDiscoverer)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidlazyLoadArguments()Load the param information only when needed.ObjectlookupVariable(String name)Look up a named variable within this evaluation context.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
Constructor Detail
MethodBasedEvaluationContext
public MethodBasedEvaluationContext(Object rootObject, Method method, Object[] arguments, ParameterNameDiscoverer parameterNameDiscoverer)
Method Detail
lookupVariable
public Object lookupVariable(String name)
Description copied from interface:EvaluationContextLook up a named variable within this evaluation context.- Specified by:
lookupVariablein interfaceEvaluationContext- Overrides:
lookupVariablein classStandardEvaluationContext- Parameters:
name- variable to lookup- Returns:
- the value of the variable, or
nullif not found
lazyLoadArguments
protected void lazyLoadArguments()
Load the param information only when needed.