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

public abstract Class AbstractFallbackJCacheOperationSource

extends Object
implements JCacheOperationSource
Class Inheritance
All Implemented Interfaces
org.springframework.cache.jcache.interceptor.JCacheOperationSource
Known Direct Subclasses
org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
Imports
java.lang.reflect.Method, .Modifier, java.util.Map, java.util.concurrent.ConcurrentHashMap, org.apache.commons.logging.Log, .LogFactory, org.springframework.aop.support.AopUtils, org.springframework.core.MethodClassKey, org.springframework.lang.Nullable

Abstract implementation of JCacheOperationSource that caches attributes for methods and implements a fallback policy: 1. specific target method; 2. declaring method.

This implementation caches attributes by method after they are first used.

Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1
See Also
org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource

Field Summary

Modifier and TypeField and Description
private final Map<MethodClassKey, Object>
protected final Log
private static final Object
NULL_CACHING_ATTRIBUTE

Canonical value held in cache to indicate no caching attribute was found for this method and we don't need to look again.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
allowPublicMethodsOnly()

Should only public methods be allowed to have caching semantics?

private JCacheOperation<?>
computeCacheOperation(Method method, Class<?> targetClass)

protected abstract JCacheOperation<?>

Returns:

the cache operation associated with this method (or null if none)
findCacheOperation
(Method
the method to retrieve the operation for
method
,
Class<?>
the target class
targetType
)

Subclasses need to implement this to return the caching operation for the given method, if any.

public JCacheOperation<?>
getCacheOperation(Method
the method to introspect
method
,
Class<?>
the target class (may be null, in which case the declaring class of the method must be used)
targetClass
)

Implements org.springframework.cache.jcache.interceptor.JCacheOperationSource.getCacheOperation.

Return the cache operations for this method, or null if the method contains no JSR-107 related metadata.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private final Map<MethodClassKey, Object> cache
loggerback to summary
protected final Log logger
NULL_CACHING_ATTRIBUTEback to summary
private static final Object NULL_CACHING_ATTRIBUTE

Canonical value held in cache to indicate no caching attribute was found for this method and we don't need to look again.

Constructor Detail

AbstractFallbackJCacheOperationSourceback to summary
public AbstractFallbackJCacheOperationSource()

Method Detail

allowPublicMethodsOnlyback to summary
protected boolean allowPublicMethodsOnly()

Should only public methods be allowed to have caching semantics?

The default implementation returns false.

computeCacheOperationback to summary
private JCacheOperation<?> computeCacheOperation(Method method, Class<?> targetClass)
Annotations
@Nullable
findCacheOperationback to summary
protected abstract JCacheOperation<?> findCacheOperation(Method method, Class<?> targetType)

Subclasses need to implement this to return the caching operation for the given method, if any.

Parameters
method:Method

the method to retrieve the operation for

targetType:Class<?>

the target class

Returns:JCacheOperation<?>

the cache operation associated with this method (or null if none)

Annotations
@Nullable
getCacheOperationback to summary
public JCacheOperation<?> getCacheOperation(Method method, Class<?> targetClass)

Implements org.springframework.cache.jcache.interceptor.JCacheOperationSource.getCacheOperation.

Doc from org.springframework.cache.jcache.interceptor.JCacheOperationSource.getCacheOperation.

Return the cache operations for this method, or null if the method contains no JSR-107 related metadata.

Parameters
method:Method

the method to introspect

targetClass:Class<?>

the target class (may be null, in which case the declaring class of the method must be used)

Returns:JCacheOperation<?>

the cache operation for this method, or null if none found

Annotations
@Override