class CacheEvaluationContext extends MethodBasedEvaluationContext
Also define a set of "unavailable variables" (i.e. variables that should lead to an exception right the way when they are accessed). This can be useful to verify a condition does not match even when not all potential variables are present.
To limit the creation of objects, an ugly constructor is used (rather then a dedicated 'closure'-like class for deferred execution).
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
unavailableVariables |
Constructor and Description |
---|
CacheEvaluationContext(java.lang.Object rootObject,
java.lang.reflect.Method method,
java.lang.Object[] args,
ParameterNameDiscoverer paramDiscoverer) |
Modifier and Type | Method and Description |
---|---|
void |
addUnavailableVariable(java.lang.String name)
Add the specified variable name as unavailable for that context.
|
java.lang.Object |
lookupVariable(java.lang.String name)
Load the param information only when needed.
|
lazyLoadArguments
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
private final java.util.List<java.lang.String> unavailableVariables
CacheEvaluationContext(java.lang.Object rootObject, java.lang.reflect.Method method, java.lang.Object[] args, ParameterNameDiscoverer paramDiscoverer)
public void addUnavailableVariable(java.lang.String name)
This permits the validation of expressions that could potentially a variable even when such variable isn't available yet. Any expression trying to use that variable should therefore fail to evaluate.
public java.lang.Object lookupVariable(java.lang.String name)
lookupVariable
in interface EvaluationContext
lookupVariable
in class MethodBasedEvaluationContext
name
- variable to lookup