public abstract class AbstractFallbackJCacheOperationSource extends java.lang.Object implements JCacheOperationSource
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.
AbstractFallbackCacheOperationSource| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Object,java.lang.Object> |
cache |
protected Log |
logger |
private static java.lang.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 and Description |
|---|
AbstractFallbackJCacheOperationSource() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
allowPublicMethodsOnly()
Should only public methods be allowed to have caching semantics?
|
private JCacheOperation<?> |
computeCacheOperation(java.lang.reflect.Method method,
java.lang.Class<?> targetClass) |
protected abstract 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.
|
JCacheOperation<?> |
getCacheOperation(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Return the cache operations for this method, or
null
if the method contains no JSR-107 related metadata. |
private static final java.lang.Object NULL_CACHING_ATTRIBUTE
protected final Log logger
private final java.util.Map<java.lang.Object,java.lang.Object> cache
public AbstractFallbackJCacheOperationSource()
public JCacheOperation<?> getCacheOperation(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
JCacheOperationSourcenull
if the method contains no JSR-107 related metadata.getCacheOperation in interface JCacheOperationSourcemethod - the method to introspecttargetClass - the target class (may be null, in which case
the declaring class of the method must be used)null if none foundprivate JCacheOperation<?> computeCacheOperation(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
protected abstract JCacheOperation<?> findCacheOperation(java.lang.reflect.Method method, java.lang.Class<?> targetType)
method - the method to retrieve the operation fortargetType - the target classnull if none)protected boolean allowPublicMethodsOnly()
The default implementation returns false.