Top Description Fields Constructors Methods
org.springframework.cache.interceptor

pack-priv Class CacheOperationExpressionEvaluator

extends CachedExpressionEvaluator
Class Inheritance
Imports
java.lang.reflect.Method, java.util.Collection, .Map, java.util.concurrent.ConcurrentHashMap, org.springframework.cache.Cache, org.springframework.context.expression.AnnotatedElementKey, .CachedExpressionEvaluator, org.springframework.expression.EvaluationContext, .Expression, org.springframework.lang.Nullable

Utility class handling the SpEL expression parsing. Meant to be used as a reusable, thread-safe component.

Performs internal caching for performance reasons using AnnotatedElementKey.

Authors
Costin Leau, Phillip Webb, Sam Brannen, Stephane Nicoll
Since
3.1

Field Summary

Modifier and TypeField and Description
private final Map<CachedExpressionEvaluator.ExpressionKey, Expression>
private final CacheEvaluationContextFactory
private final Map<CachedExpressionEvaluator.ExpressionKey, Expression>
public static final Object
NO_RESULT

Indicate that there is no result variable.

public static final Object
RESULT_UNAVAILABLE

Indicate that the result variable cannot be used at all.

public static final String
RESULT_VARIABLE

The name of the variable holding the result object.

private final Map<CachedExpressionEvaluator.ExpressionKey, Expression>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
clear()

Clear all caches.

public boolean
condition(String conditionExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)

public EvaluationContext

Returns:

the evaluation context
createEvaluationContext
(Collection<? extends Cache>
the current caches
caches
,
Method
the method
method
,
Object[]
the method arguments
args
,
Object
the target object
target
,
Class<?>
the target class
targetClass
,
Method targetMethod, Object
the return value (can be null) or NO_RESULT if there is no return at this time
result
)

Create an EvaluationContext.

public Object
key(String keyExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)

public boolean
unless(String unlessExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)

Inherited from org.springframework.context.expression.CachedExpressionEvaluator:
getExpressiongetParameterNameDiscoverergetParserparseExpression

Field Detail

conditionCacheback to summary
private final Map<CachedExpressionEvaluator.ExpressionKey, Expression> conditionCache
evaluationContextFactoryback to summary
private final CacheEvaluationContextFactory evaluationContextFactory
keyCacheback to summary
private final Map<CachedExpressionEvaluator.ExpressionKey, Expression> keyCache
NO_RESULTback to summary
public static final Object NO_RESULT

Indicate that there is no result variable.

RESULT_UNAVAILABLEback to summary
public static final Object RESULT_UNAVAILABLE

Indicate that the result variable cannot be used at all.

RESULT_VARIABLEback to summary
public static final String RESULT_VARIABLE

The name of the variable holding the result object.

unlessCacheback to summary
private final Map<CachedExpressionEvaluator.ExpressionKey, Expression> unlessCache

Constructor Detail

CacheOperationExpressionEvaluatorback to summary
public CacheOperationExpressionEvaluator(CacheEvaluationContextFactory evaluationContextFactory)

Method Detail

clearback to summary
pack-priv void clear()

Clear all caches.

conditionback to summary
public boolean condition(String conditionExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)
createEvaluationContextback to summary
public EvaluationContext createEvaluationContext(Collection<? extends Cache> caches, Method method, Object[] args, Object target, Class<?> targetClass, Method targetMethod, Object result)

Create an EvaluationContext.

Parameters
caches:Collection<? extends Cache>

the current caches

method:Method

the method

args:Object[]

the method arguments

target:Object

the target object

targetClass:Class<?>

the target class

result:Object

the return value (can be null) or NO_RESULT if there is no return at this time

Returns:EvaluationContext

the evaluation context

keyback to summary
public Object key(String keyExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)
Annotations
@Nullable
unlessback to summary
public boolean unless(String unlessExpression, AnnotatedElementKey methodKey, EvaluationContext evalContext)