Top Description Fields Constructors Methods
org.springframework.context.expression

public Class MethodBasedEvaluationContext

extends StandardEvaluationContext
Class Inheritance
Known Direct Subclasses
org.springframework.cache.interceptor.CacheEvaluationContext
Imports
java.lang.reflect.Method, java.util.Arrays, org.springframework.core.KotlinDetector, .ParameterNameDiscoverer, org.springframework.expression.spel.support.StandardEvaluationContext, org.springframework.lang.Nullable, org.springframework.util.ObjectUtils

A method-based org.springframework.expression.EvaluationContext that provides explicit support for method-based invocations.

Expose the actual method arguments using the following aliases:

  1. pX where X is the index of the argument (p0 for the first argument)
  2. aX where X is the index of the argument (a1 for the second argument)
  3. the name of the parameter as discovered by a configurable ParameterNameDiscoverer
Authors
Stephane Nicoll, Juergen Hoeller, Sebastien Deleuze
Since
4.2

Field Summary

Modifier and TypeField and Description
private final Object[]
private boolean
private final Method
private final ParameterNameDiscoverer

Constructor Summary

AccessConstructor and Description
public
MethodBasedEvaluationContext(Object rootObject, Method method, Object[] arguments, ParameterNameDiscoverer parameterNameDiscoverer)

Method Summary

Modifier and TypeMethod and Description
protected void
lazyLoadArguments()

Load the param information only when needed.

public Object
lookupVariable(String
the name of the variable or function to look up
name
)

Overrides org.springframework.expression.spel.support.StandardEvaluationContext.lookupVariable.

Implements org.springframework.expression.EvaluationContext.lookupVariable.

Look up a named variable or function within this evaluation context.
Inherited from org.springframework.expression.spel.support.StandardEvaluationContext:
addConstructorResolveraddMethodResolveraddPropertyAccessorapplyDelegatesTogetBeanResolvergetConstructorResolversgetMethodResolversgetOperatorOverloadergetPropertyAccessorsgetRootObjectgetTypeComparatorgetTypeConvertergetTypeLocatorregisterFunctionregisterFunctionregisterMethodFilterremoveConstructorResolverremoveMethodResolverremovePropertyAccessorsetBeanResolversetConstructorResolverssetMethodResolverssetOperatorOverloadersetPropertyAccessorssetRootObjectsetRootObjectsetTypeComparatorsetTypeConvertersetTypeLocatorsetVariablesetVariables

Field Detail

argumentsback to summary
private final Object[] arguments
argumentsLoadedback to summary
private boolean argumentsLoaded
methodback to summary
private final Method method
parameterNameDiscovererback to summary
private final ParameterNameDiscoverer parameterNameDiscoverer

Constructor Detail

MethodBasedEvaluationContextback to summary
public MethodBasedEvaluationContext(Object rootObject, Method method, Object[] arguments, ParameterNameDiscoverer parameterNameDiscoverer)

Method Detail

lazyLoadArgumentsback to summary
protected void lazyLoadArguments()

Load the param information only when needed.

lookupVariableback to summary
public Object lookupVariable(String name)

Overrides org.springframework.expression.spel.support.StandardEvaluationContext.lookupVariable.

Implements org.springframework.expression.EvaluationContext.lookupVariable.

Doc from org.springframework.expression.spel.support.StandardEvaluationContext.lookupVariable.

Look up a named variable or function within this evaluation context.

Note that variables and functions share a common namespace in this evaluation context. See the class-level documentation for details.

Parameters
name:String

the name of the variable or function to look up

Returns:Object

the value of the variable or function, or null if not found

Annotations
@Override
@Nullable