Class AnnotationJCacheOperationSource
java.lang.Object
org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
- All Implemented Interfaces:
 JCacheOperationSource
- Direct Known Subclasses:
 DefaultJCacheOperationSource
Implementation of the 
JCacheOperationSource interface that reads
 the JSR-107 CacheResult, CachePut, CacheRemove and
 CacheRemoveAll annotations.- Since:
 - 4.1
 - Author:
 - Stephane Nicoll, Juergen Hoeller
 
- 
Field Summary
Fields inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
logger - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.cache.jcache.interceptor.CachePutOperationcreateCachePutOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CachePut ann) protected org.springframework.cache.jcache.interceptor.CacheRemoveAllOperationcreateCacheRemoveAllOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheRemoveAll ann) protected org.springframework.cache.jcache.interceptor.CacheRemoveOperationcreateCacheRemoveOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheRemove ann) protected org.springframework.cache.jcache.interceptor.CacheResultOperationcreateCacheResultOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheResult ann) protected StringdetermineCacheName(Method method, javax.cache.annotation.CacheDefaults defaults, String candidate) protected javax.cache.annotation.CacheResolverFactorydetermineCacheResolverFactory(javax.cache.annotation.CacheDefaults defaults, Class<? extends javax.cache.annotation.CacheResolverFactory> candidate) protected KeyGeneratordetermineKeyGenerator(javax.cache.annotation.CacheDefaults defaults, Class<? extends javax.cache.annotation.CacheKeyGenerator> candidate) protected JCacheOperation<?>findCacheOperation(Method method, Class<?> targetType) Subclasses need to implement this to return the caching operation for the given method, if any.protected StringgenerateDefaultCacheName(Method method) Generate a default cache name for the specifiedMethod.protected abstract <T> TLocate or create an instance of the specified cache strategytype.protected javax.cache.annotation.CacheDefaultsgetCacheDefaults(Method method, Class<?> targetType) protected CacheResolvergetCacheResolver(javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<?> details) protected abstract CacheResolverReturn the defaultCacheResolverif none is set.protected abstract CacheResolverReturn the default exceptionCacheResolverif none is set.protected abstract KeyGeneratorReturn the defaultKeyGeneratorif none is set.protected CacheResolvergetExceptionCacheResolver(javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<javax.cache.annotation.CacheResult> details) booleanisCandidateClass(Class<?> targetClass) Determine whether the given class is a candidate for cache operations in the metadata format of thisJCacheOperationSource.Methods inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
allowPublicMethodsOnly, getCacheOperation, hasCacheOperation 
- 
Constructor Details
- 
AnnotationJCacheOperationSource
public AnnotationJCacheOperationSource() 
 - 
 - 
Method Details
- 
isCandidateClass
Description copied from interface:JCacheOperationSourceDetermine whether the given class is a candidate for cache operations in the metadata format of thisJCacheOperationSource.If this method returns
false, the methods on the given class will not get traversed forJCacheOperationSource.getCacheOperation(java.lang.reflect.Method, java.lang.Class<?>)introspection. Returningfalseis therefore an optimization for non-affected classes, whereastruesimply means that the class needs to get fully introspected for each method on the given class individually.- Parameters:
 targetClass- the class to introspect- Returns:
 falseif the class is known to have no cache operation metadata at class or method level;trueotherwise. The default implementation returnstrue, leading to regular introspection.- See Also:
 
 - 
findCacheOperation
@Nullable protected JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) Description copied from class:AbstractFallbackJCacheOperationSourceSubclasses need to implement this to return the caching operation for the given method, if any.- Specified by:
 findCacheOperationin classAbstractFallbackJCacheOperationSource- Parameters:
 method- the method to retrieve the operation fortargetType- the target class- Returns:
 - the cache operation associated with this method
 (or 
nullif none) 
 - 
getCacheDefaults
 - 
createCacheResultOperation
 - 
createCachePutOperation
 - 
createCacheRemoveOperation
 - 
createCacheRemoveAllOperation
 - 
getCacheResolver
protected CacheResolver getCacheResolver(@Nullable javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<?> details)  - 
getExceptionCacheResolver
protected CacheResolver getExceptionCacheResolver(@Nullable javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<javax.cache.annotation.CacheResult> details)  - 
determineCacheResolverFactory
 - 
determineKeyGenerator
protected KeyGenerator determineKeyGenerator(@Nullable javax.cache.annotation.CacheDefaults defaults, Class<? extends javax.cache.annotation.CacheKeyGenerator> candidate)  - 
determineCacheName
 - 
generateDefaultCacheName
Generate a default cache name for the specifiedMethod.- Parameters:
 method- the annotated method- Returns:
 - the default cache name, according to JSR-107
 
 - 
getBean
Locate or create an instance of the specified cache strategytype.- Parameters:
 type- the type of the bean to manage- Returns:
 - the required bean
 
 - 
getDefaultCacheResolver
Return the defaultCacheResolverif none is set. - 
getDefaultExceptionCacheResolver
Return the default exceptionCacheResolverif none is set. - 
getDefaultKeyGenerator
Return the defaultKeyGeneratorif none is set. 
 -