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
public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJCacheOperationSource
Implementation of theJCacheOperationSourceinterface that reads the JSR-107CacheResult,CachePut,CacheRemoveandCacheRemoveAllannotations.- Since:
- 4.1
- Author:
- Stephane Nicoll
Field Summary
Fields inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
logger
Constructor Summary
Constructors Constructor Description AnnotationJCacheOperationSource()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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> TgetBean(Class<T> type)Locate 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 CacheResolvergetDefaultCacheResolver()Return the defaultCacheResolverif none is set.protected abstract CacheResolvergetDefaultExceptionCacheResolver()Return the default exceptionCacheResolverif none is set.protected abstract KeyGeneratorgetDefaultKeyGenerator()Return the defaultKeyGeneratorif none is set.protected CacheResolvergetExceptionCacheResolver(javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<javax.cache.annotation.CacheResult> details)Methods inherited from class org.springframework.cache.jcache.interceptor.AbstractFallbackJCacheOperationSource
allowPublicMethodsOnly, getCacheOperation
Constructor Detail
AnnotationJCacheOperationSource
public AnnotationJCacheOperationSource()
Method Detail
findCacheOperation
protected JCacheOperation<?> findCacheOperation(Method method, 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
protected javax.cache.annotation.CacheDefaults getCacheDefaults(Method method, Class<?> targetType)
createCacheResultOperation
protected org.springframework.cache.jcache.interceptor.CacheResultOperation createCacheResultOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheResult ann)
createCachePutOperation
protected org.springframework.cache.jcache.interceptor.CachePutOperation createCachePutOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CachePut ann)
createCacheRemoveOperation
protected org.springframework.cache.jcache.interceptor.CacheRemoveOperation createCacheRemoveOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheRemove ann)
createCacheRemoveAllOperation
protected org.springframework.cache.jcache.interceptor.CacheRemoveAllOperation createCacheRemoveAllOperation(Method method, javax.cache.annotation.CacheDefaults defaults, javax.cache.annotation.CacheRemoveAll ann)
getCacheResolver
protected CacheResolver getCacheResolver(javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<?> details)
getExceptionCacheResolver
protected CacheResolver getExceptionCacheResolver(javax.cache.annotation.CacheResolverFactory factory, javax.cache.annotation.CacheMethodDetails<javax.cache.annotation.CacheResult> details)
determineCacheResolverFactory
protected javax.cache.annotation.CacheResolverFactory determineCacheResolverFactory(javax.cache.annotation.CacheDefaults defaults, Class<? extends javax.cache.annotation.CacheResolverFactory> candidate)
determineKeyGenerator
protected KeyGenerator determineKeyGenerator(javax.cache.annotation.CacheDefaults defaults, Class<? extends javax.cache.annotation.CacheKeyGenerator> candidate)
determineCacheName
protected String determineCacheName(Method method, javax.cache.annotation.CacheDefaults defaults, String candidate)
generateDefaultCacheName
protected String generateDefaultCacheName(Method method)
Generate a default cache name for the specifiedMethod.- Parameters:
method- the annotated method- Returns:
- the default cache name, according to JSR-107
getBean
protected abstract <T> T getBean(Class<T> type)
Locate or create an instance of the specified cache strategytype.- Parameters:
type- the type of the bean to manage- Returns:
- the required bean
getDefaultCacheResolver
protected abstract CacheResolver getDefaultCacheResolver()
Return the defaultCacheResolverif none is set.
getDefaultExceptionCacheResolver
protected abstract CacheResolver getDefaultExceptionCacheResolver()
Return the default exceptionCacheResolverif none is set.
getDefaultKeyGenerator
protected abstract KeyGenerator getDefaultKeyGenerator()
Return the defaultKeyGeneratorif none is set.