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

public Class JCacheInterceptor

extends JCacheAspectSupport
implements MethodInterceptor, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.aopalliance.intercept.MethodInterceptor, org.aopalliance.intercept.Interceptor, org.aopalliance.aop.Advice
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.lang.reflect.Method, java.util.function.Supplier, org.aopalliance.intercept.MethodInterceptor, .MethodInvocation, org.springframework.cache.interceptor.CacheErrorHandler, .CacheOperationInvoker, .SimpleCacheErrorHandler, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.util.function.SingletonSupplier

AOP Alliance MethodInterceptor for declarative cache management using JSR-107 caching annotations.

Derives from the JCacheAspectSupport class which contains the integration with Spring's underlying caching API. JCacheInterceptor simply calls the relevant superclass method.

JCacheInterceptors are thread-safe.

Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1
See Also
org.springframework.cache.interceptor.CacheInterceptor

Field Summary

Inherited from org.springframework.cache.jcache.interceptor.JCacheAspectSupport:
logger

Constructor Summary

AccessConstructor and Description
public
JCacheInterceptor()

Construct a new JCacheInterceptor with the default error handler.

public
JCacheInterceptor(Supplier<CacheErrorHandler>
a supplier for the error handler to use, applying the default error handler if the supplier is not resolvable
errorHandler
)

Construct a new JCacheInterceptor with the given error handler.

Method Summary

Modifier and TypeMethod and Description
public Object
invoke(final MethodInvocation
the method invocation joinpoint
invocation
)

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation.

Inherited from org.springframework.cache.jcache.interceptor.JCacheAspectSupport:
afterPropertiesSetexecutegetCacheOperationSourceinvokeOperationsetCacheOperationSource

Constructor Detail

JCacheInterceptorback to summary
public JCacheInterceptor()

Construct a new JCacheInterceptor with the default error handler.

JCacheInterceptorback to summary
public JCacheInterceptor(Supplier<CacheErrorHandler> errorHandler)

Construct a new JCacheInterceptor with the given error handler.

Parameters
errorHandler:Supplier<CacheErrorHandler>

a supplier for the error handler to use, applying the default error handler if the supplier is not resolvable

Since
5.1

Method Detail

invokeback to summary
public Object invoke(final MethodInvocation invocation) throws Throwable

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint#proceed().

Parameters
invocation:MethodInvocation

the method invocation joinpoint

Returns:Object

the result of the call to Joinpoint#proceed(); might be intercepted by the interceptor

Annotations
@Override
@Nullable
Exceptions
Throwable:
if the interceptors or the target object throws an exception