Top Description Inners Fields Constructors Methods
org.springframework.cache.jcache.interceptor

public Class JCacheAspectSupport

extends AbstractCacheInvoker
implements InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean
Known Direct Subclasses
org.springframework.cache.jcache.interceptor.JCacheInterceptor
Imports
java.lang.annotation.Annotation, java.lang.reflect.Method, org.apache.commons.logging.Log, .LogFactory, org.springframework.aop.framework.AopProxyUtils, org.springframework.beans.factory.InitializingBean, org.springframework.cache.interceptor.AbstractCacheInvoker, .BasicOperation, .CacheOperationInvocationContext, .CacheOperationInvoker, org.springframework.lang.Nullable, org.springframework.util.Assert

Base class for JSR-107 caching aspects, such as the JCacheInterceptor or an AspectJ aspect.

Use the Spring caching abstraction for cache-related operations. No JSR-107 javax.cache.Cache or javax.cache.CacheManager are required to process standard JSR-107 cache annotations.

The JCacheOperationSource is used for determining caching operations

A cache aspect is serializable if its JCacheOperationSource is serializable.

Author
Stephane Nicoll
Since
4.1
See Also
org.springframework.cache.interceptor.CacheAspectSupport, KeyGeneratorAdapter, CacheResolverAdapter

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private JCacheOperationSource
private CachePutInterceptor
private CacheRemoveAllInterceptor
private CacheRemoveEntryInterceptor
private CacheResultInterceptor
private boolean
protected final Log
Inherited from org.springframework.cache.interceptor.AbstractCacheInvoker:
errorHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

private CacheOperationInvocationContext<?>
protected Object
execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args)

private Object
public JCacheOperationSource
getCacheOperationSource()

Return the CacheOperationSource for this cache aspect.

protected Object

Returns:

the result of the invocation
invokeOperation
(CacheOperationInvoker
the invoker handling the operation being cached
invoker
)

Execute the underlying operation (typically in case of cache miss) and return the result of the invocation.

public void
setCacheOperationSource(JCacheOperationSource cacheOperationSource)

Set the CacheOperationSource for this cache aspect.

Inherited from org.springframework.cache.interceptor.AbstractCacheInvoker:
doCleardoEvictdoGetdoPutgetErrorHandlersetErrorHandler

Field Detail

cacheOperationSourceback to summary
private JCacheOperationSource cacheOperationSource
Annotations
@Nullable
cachePutInterceptorback to summary
private CachePutInterceptor cachePutInterceptor
Annotations
@Nullable
cacheRemoveAllInterceptorback to summary
private CacheRemoveAllInterceptor cacheRemoveAllInterceptor
Annotations
@Nullable
cacheRemoveEntryInterceptorback to summary
private CacheRemoveEntryInterceptor cacheRemoveEntryInterceptor
Annotations
@Nullable
cacheResultInterceptorback to summary
private CacheResultInterceptor cacheResultInterceptor
Annotations
@Nullable
initializedback to summary
private boolean initialized
loggerback to summary
protected final Log logger

Constructor Detail

JCacheAspectSupportback to summary
public JCacheAspectSupport()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
createCacheOperationInvocationContextback to summary
private CacheOperationInvocationContext<?> createCacheOperationInvocationContext(Object target, Object[] args, JCacheOperation<?> operation)
Annotations
@SuppressWarnings:unchecked
executeback to summary
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args)
Annotations
@Nullable
executeback to summary
private Object execute(CacheOperationInvocationContext<?> context, CacheOperationInvoker invoker)
Annotations
@SuppressWarnings:unchecked
@Nullable
getCacheOperationSourceback to summary
public JCacheOperationSource getCacheOperationSource()

Return the CacheOperationSource for this cache aspect.

invokeOperationback to summary
protected Object invokeOperation(CacheOperationInvoker invoker)

Execute the underlying operation (typically in case of cache miss) and return the result of the invocation. If an exception occurs it will be wrapped in a ThrowableWrapper: the exception can be handled or modified but it must be wrapped in a ThrowableWrapper as well.

Parameters
invoker:CacheOperationInvoker

the invoker handling the operation being cached

Returns:Object

the result of the invocation

Annotations
@Nullable
See Also
CacheOperationInvoker#invoke()
setCacheOperationSourceback to summary
public void setCacheOperationSource(JCacheOperationSource cacheOperationSource)

Set the CacheOperationSource for this cache aspect.

org.springframework.cache.jcache.interceptor back to summary

private Class JCacheAspectSupport.CacheOperationInvokerAdapter

extends Object
implements CacheOperationInvoker
Class Inheritance
  • java.lang.Object
  • org.springframework.cache.jcache.interceptor.JCacheAspectSupport.CacheOperationInvokerAdapter
All Implemented Interfaces
org.springframework.cache.interceptor.CacheOperationInvoker

Field Summary

Modifier and TypeField and Description
private final CacheOperationInvoker

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
invoke()

Implements org.springframework.cache.interceptor.CacheOperationInvoker.invoke.

Invoke the cache operation defined by this instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final CacheOperationInvoker delegate

Constructor Detail

CacheOperationInvokerAdapterback to summary
public CacheOperationInvokerAdapter(CacheOperationInvoker delegate)

Method Detail

invokeback to summary
public Object invoke() throws ThrowableWrapper

Implements org.springframework.cache.interceptor.CacheOperationInvoker.invoke.

Doc from org.springframework.cache.interceptor.CacheOperationInvoker.invoke.

Invoke the cache operation defined by this instance. Wraps any exception that is thrown during the invocation in a ThrowableWrapper.

Returns:Object

the result of the operation

Annotations
@Override
Exceptions
ThrowableWrapper:
if an error occurred while invoking the operation