|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.cache.interceptor.CacheAspectSupport
public abstract class CacheAspectSupport
Base class for caching aspects, such as the CacheInterceptor
or an AspectJ aspect.
This enables the underlying Spring caching infrastructure to be used easily to implement an aspect for any aspect system.
Subclasses are responsible for calling methods in this class in the correct order.
If no caching name has been specified in the CacheOperationDefinition,
the exposed name will be the fully-qualified class name + "." + method name
(by default).
Uses the Strategy design pattern. A CacheManager
implementation will perform the actual transaction management, and a
CacheDefinitionSource is used for determining caching operation definitions.
A cache aspect is serializable if its CacheManager
and CacheDefinitionSource are serializable.
| Nested Class Summary | |
|---|---|
protected class |
CacheAspectSupport.CacheOperationContext
|
| Field Summary | |
|---|---|
protected Log |
logger
|
| Constructor Summary | |
|---|---|
CacheAspectSupport()
|
|
| Method Summary | ||
|---|---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
|
protected Object |
execute(Callable<Object> invocation,
Object target,
Method method,
Object[] args)
|
|
CacheDefinitionSource |
getCacheDefinitionSource()
|
|
CacheManager |
getCacheManager()
|
|
protected Collection<Cache<?,?>> |
getCaches(CacheDefinition definition)
|
|
KeyGenerator |
getKeyGenerator()
|
|
protected CacheAspectSupport.CacheOperationContext |
getOperationContext(CacheDefinition definition,
Method method,
Object[] args,
Class<?> targetClass)
|
|
protected String |
methodIdentification(Method method,
Class<?> targetClass)
Convenience method to return a String representation of this Method for use in logging. |
|
void |
setCacheDefinitionSources(CacheDefinitionSource... cacheDefinitionSources)
Set multiple cache definition sources which are used to find the cache attributes. |
|
void |
setCacheManager(CacheManager cacheManager)
|
|
|
setKeyGenerator(KeyGenerator<K> keyGenerator)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Log logger
| Constructor Detail |
|---|
public CacheAspectSupport()
| Method Detail |
|---|
public void afterPropertiesSet()
InitializingBeanThis method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet in interface InitializingBean
protected String methodIdentification(Method method,
Class<?> targetClass)
method - the method we're interested intargetClass - class the method is on
ClassUtils.getQualifiedMethodName(java.lang.reflect.Method)public CacheManager getCacheManager()
public void setCacheManager(CacheManager cacheManager)
public CacheDefinitionSource getCacheDefinitionSource()
public KeyGenerator getKeyGenerator()
public <K> void setKeyGenerator(KeyGenerator<K> keyGenerator)
public void setCacheDefinitionSources(CacheDefinitionSource... cacheDefinitionSources)
protected Collection<Cache<?,?>> getCaches(CacheDefinition definition)
protected CacheAspectSupport.CacheOperationContext getOperationContext(CacheDefinition definition,
Method method,
Object[] args,
Class<?> targetClass)
protected Object execute(Callable<Object> invocation,
Object target,
Method method,
Object[] args)
throws Exception
Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||