Class AbstractFallbackJCacheOperationSource
java.lang.Object
org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
- All Implemented Interfaces:
JCacheOperationSource
- Direct Known Subclasses:
AnnotationJCacheOperationSource
public abstract class AbstractFallbackJCacheOperationSource
extends Object
implements JCacheOperationSource
Abstract implementation of
JCacheOperationSource that caches operations
for methods and implements a fallback policy: 1. specific target method;
2. declaring method.- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanShould only public methods be allowed to have caching semantics?protected abstract @Nullable JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) Subclasses need to implement this to return the caching operation for the given method, if any.getCacheOperation(Method method, @Nullable Class<?> targetClass) Return the cache operations for this method, ornullif the method contains no JSR-107 related metadata.booleanhasCacheOperation(Method method, @Nullable Class<?> targetClass) Determine whether there is a JSR-107 cache operation for the given method.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JCacheOperationSource
isCandidateClass
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
AbstractFallbackJCacheOperationSource
public AbstractFallbackJCacheOperationSource()
-
-
Method Details
-
hasCacheOperation
Description copied from interface:JCacheOperationSourceDetermine whether there is a JSR-107 cache operation for the given method.- Specified by:
hasCacheOperationin interfaceJCacheOperationSource- Parameters:
method- the method to introspecttargetClass- the target class (can benull, in which case the declaring class of the method must be used)- See Also:
-
getCacheOperation
public @Nullable JCacheOperation<?> getCacheOperation(Method method, @Nullable Class<?> targetClass) Description copied from interface:JCacheOperationSourceReturn the cache operations for this method, ornullif the method contains no JSR-107 related metadata.- Specified by:
getCacheOperationin interfaceJCacheOperationSource- Parameters:
method- the method to introspecttargetClass- the target class (can benull, in which case the declaring class of the method must be used)- Returns:
- the cache operation for this method, or
nullif none found
-
findCacheOperation
protected abstract @Nullable JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) Subclasses need to implement this to return the caching operation for the given method, if any.- Parameters:
method- the method to retrieve the operation fortargetType- the target class- Returns:
- the cache operation associated with this method
(or
nullif none)
-
allowPublicMethodsOnly
protected boolean allowPublicMethodsOnly()Should only public methods be allowed to have caching semantics?The default implementation returns
false.
-