public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJCacheOperationSource
JCacheOperationSource
interface that reads
the JSR-107 CacheResult
, CachePut
, CacheRemove
and
CacheRemoveAll
annotations.logger
Constructor and Description |
---|
AnnotationJCacheOperationSource() |
Modifier and Type | Method and Description |
---|---|
private int |
countNonNull(java.lang.Object... instances) |
protected CachePutOperation |
createCachePutOperation(java.lang.reflect.Method method,
CacheDefaults defaults,
CachePut ann) |
protected CacheRemoveAllOperation |
createCacheRemoveAllOperation(java.lang.reflect.Method method,
CacheDefaults defaults,
CacheRemoveAll ann) |
protected CacheRemoveOperation |
createCacheRemoveOperation(java.lang.reflect.Method method,
CacheDefaults defaults,
CacheRemove ann) |
protected CacheResultOperation |
createCacheResultOperation(java.lang.reflect.Method method,
CacheDefaults defaults,
CacheResult ann) |
private <A extends java.lang.annotation.Annotation> |
createMethodDetails(java.lang.reflect.Method method,
A annotation,
java.lang.String cacheName) |
protected java.lang.String |
determineCacheName(java.lang.reflect.Method method,
CacheDefaults defaults,
java.lang.String candidate) |
protected CacheResolverFactory |
determineCacheResolverFactory(CacheDefaults defaults,
java.lang.Class<? extends CacheResolverFactory> candidate) |
protected KeyGenerator |
determineKeyGenerator(CacheDefaults defaults,
java.lang.Class<? extends CacheKeyGenerator> candidate) |
protected JCacheOperation<?> |
findCacheOperation(java.lang.reflect.Method method,
java.lang.Class<?> targetType)
Subclasses need to implement this to return the caching operation
for the given method, if any.
|
protected java.lang.String |
generateDefaultCacheName(java.lang.reflect.Method method)
Generate a default cache name for the specified
Method . |
protected abstract <T> T |
getBean(java.lang.Class<T> type)
Locate or create an instance of the specified cache strategy
type . |
protected CacheDefaults |
getCacheDefaults(java.lang.reflect.Method method,
java.lang.Class<?> targetType) |
protected CacheResolver |
getCacheResolver(CacheResolverFactory factory,
<any> details) |
protected abstract CacheResolver |
getDefaultCacheResolver()
Return the default
CacheResolver if none is set. |
protected abstract CacheResolver |
getDefaultExceptionCacheResolver()
Return the default exception
CacheResolver if none is set. |
protected abstract KeyGenerator |
getDefaultKeyGenerator()
Return the default
KeyGenerator if none is set. |
protected CacheResolver |
getExceptionCacheResolver(CacheResolverFactory factory,
<any> details) |
allowPublicMethodsOnly, getCacheOperation
protected JCacheOperation<?> findCacheOperation(java.lang.reflect.Method method, @Nullable java.lang.Class<?> targetType)
AbstractFallbackJCacheOperationSource
findCacheOperation
in class AbstractFallbackJCacheOperationSource
method
- the method to retrieve the operation fortargetType
- the target classnull
if none)@Nullable protected CacheDefaults getCacheDefaults(java.lang.reflect.Method method, @Nullable java.lang.Class<?> targetType)
protected CacheResultOperation createCacheResultOperation(java.lang.reflect.Method method, @Nullable CacheDefaults defaults, CacheResult ann)
protected CachePutOperation createCachePutOperation(java.lang.reflect.Method method, @Nullable CacheDefaults defaults, CachePut ann)
protected CacheRemoveOperation createCacheRemoveOperation(java.lang.reflect.Method method, @Nullable CacheDefaults defaults, CacheRemove ann)
protected CacheRemoveAllOperation createCacheRemoveAllOperation(java.lang.reflect.Method method, @Nullable CacheDefaults defaults, CacheRemoveAll ann)
private <A extends java.lang.annotation.Annotation> <any> createMethodDetails(java.lang.reflect.Method method, A annotation, java.lang.String cacheName)
protected CacheResolver getCacheResolver(@Nullable CacheResolverFactory factory, <any> details)
protected CacheResolver getExceptionCacheResolver(@Nullable CacheResolverFactory factory, <any> details)
@Nullable protected CacheResolverFactory determineCacheResolverFactory(@Nullable CacheDefaults defaults, java.lang.Class<? extends CacheResolverFactory> candidate)
protected KeyGenerator determineKeyGenerator(@Nullable CacheDefaults defaults, java.lang.Class<? extends CacheKeyGenerator> candidate)
protected java.lang.String determineCacheName(java.lang.reflect.Method method, @Nullable CacheDefaults defaults, java.lang.String candidate)
protected java.lang.String generateDefaultCacheName(java.lang.reflect.Method method)
Method
.method
- the annotated methodprivate int countNonNull(java.lang.Object... instances)
protected abstract <T> T getBean(java.lang.Class<T> type)
type
.type
- the type of the bean to manageprotected abstract CacheResolver getDefaultCacheResolver()
CacheResolver
if none is set.protected abstract CacheResolver getDefaultExceptionCacheResolver()
CacheResolver
if none is set.protected abstract KeyGenerator getDefaultKeyGenerator()
KeyGenerator
if none is set.