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

pack-priv Class DefaultCacheInvocationContext<A extends Annotation>

extends Object
implements CacheInvocationContext<A extends Annotation>, CacheOperationInvocationContext<JCacheOperation<A extends Annotation>>
Class Inheritance
All Implemented Interfaces
org.springframework.cache.interceptor.CacheOperationInvocationContext, javax.cache.annotation.CacheInvocationContext, javax.cache.annotation.CacheMethodDetails
Known Direct Subclasses
org.springframework.cache.jcache.interceptor.DefaultCacheKeyInvocationContext
Type Parameters
<A>
the annotation type
Imports
java.lang.annotation.Annotation, java.lang.reflect.Method, java.util.Arrays, .Set, javax.cache.annotation.CacheInvocationContext, .CacheInvocationParameter, org.springframework.cache.interceptor.CacheOperationInvocationContext

The default CacheOperationInvocationContext implementation used by all interceptors. Also implements CacheInvocationContext to act as a proper bridge when calling JSR-107 javax.cache.annotation.CacheResolver
Author
Stephane Nicoll
Since
4.1

Field Summary

Modifier and TypeField and Description
private final CacheInvocationParameter[]
private final Object[]
private final JCacheOperation<A>
private final Object

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public CacheInvocationParameter[]
getAllParameters()

Implements javax.cache.annotation.CacheInvocationContext.getAllParameters.

Returns a clone of the array of all method parameters.

public Set<Annotation>
getAnnotations()

Implements javax.cache.annotation.CacheMethodDetails.getAnnotations.

An immutable Set of all Annotations on this method

public Object[]
getArgs()

Implements org.springframework.cache.interceptor.CacheOperationInvocationContext.getArgs.

Return the argument list used to invoke the method.

public A
getCacheAnnotation()

Implements javax.cache.annotation.CacheMethodDetails.getCacheAnnotation.

The caching related annotation on the method.

public String
getCacheName()

Implements javax.cache.annotation.CacheMethodDetails.getCacheName.

The cache name resolved by the implementation.

public Method
public JCacheOperation<A>
public Object
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public <T> T
unwrap(Class<T>
the class of the object to be returned. This is normally either the underlying implementation class or an interface that it implements.
cls
)

Implements javax.cache.annotation.CacheInvocationContext.unwrap.

Return an object of the specified type to allow access to the provider-specific API.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

allParametersback to summary
private final CacheInvocationParameter[] allParameters
argsback to summary
private final Object[] args
operationback to summary
private final JCacheOperation<A> operation
targetback to summary
private final Object target

Constructor Detail

DefaultCacheInvocationContextback to summary
public DefaultCacheInvocationContext(JCacheOperation<A> operation, Object target, Object[] args)

Method Detail

getAllParametersback to summary
public CacheInvocationParameter[] getAllParameters()

Implements javax.cache.annotation.CacheInvocationContext.getAllParameters.

Doc from javax.cache.annotation.CacheInvocationContext.getAllParameters.

Returns a clone of the array of all method parameters.

Returns:CacheInvocationParameter[]

An array of all parameters for the annotated method

Annotations
@Override
getAnnotationsback to summary
public Set<Annotation> getAnnotations()

Implements javax.cache.annotation.CacheMethodDetails.getAnnotations.

Doc from javax.cache.annotation.CacheMethodDetails.getAnnotations.

An immutable Set of all Annotations on this method

Returns:Set<Annotation>

An immutable Set of all Annotations on this method

Annotations
@Override
getArgsback to summary
public Object[] getArgs()

Implements org.springframework.cache.interceptor.CacheOperationInvocationContext.getArgs.

Doc from org.springframework.cache.interceptor.CacheOperationInvocationContext.getArgs.

Return the argument list used to invoke the method.

Annotations
@Override
getCacheAnnotationback to summary
public A getCacheAnnotation()

Implements javax.cache.annotation.CacheMethodDetails.getCacheAnnotation.

Doc from javax.cache.annotation.CacheMethodDetails.getCacheAnnotation.

The caching related annotation on the method. One of: CacheResult, CachePut, CacheRemove, or CacheRemoveAll

Returns:A

The caching related annotation on the method.

Annotations
@Override
getCacheNameback to summary
public String getCacheName()

Implements javax.cache.annotation.CacheMethodDetails.getCacheName.

Doc from javax.cache.annotation.CacheMethodDetails.getCacheName.

The cache name resolved by the implementation.

The cache name is determined by first looking at the cacheName attribute of the method level annotation. If that attribute is not set then the class level CacheDefaults annotation is checked. If that annotation does not exist or does not have its cacheName attribute set then the following cache name generation rules are followed:

"fully qualified class name"."method name"("fully qualified parameter class names")

For example:


package my.app;

public class DomainDao {
  @CacheResult
  public Domain getDomain(String domainId, int index) {
    ...
  }
}

Results in the cache name: "my.app.DomainDao.getDomain(java.lang.String,int)"

Returns:String

The fully resolved cache name

Annotations
@Override
getMethodback to summary
public Method getMethod()

Implements javax.cache.annotation.CacheMethodDetails.getMethod, org.springframework.cache.interceptor.CacheOperationInvocationContext.getMethod.

Doc from org.springframework.cache.interceptor.CacheOperationInvocationContext.getMethod.

Return the method which was invoked.

Returns:Method

Doc from javax.cache.annotation.CacheMethodDetails.getMethod.

The annotated method

Annotations
@Override
getOperationback to summary
public JCacheOperation<A> getOperation()

Implements org.springframework.cache.interceptor.CacheOperationInvocationContext.getOperation.

Doc from org.springframework.cache.interceptor.CacheOperationInvocationContext.getOperation.

Return the cache operation.

Annotations
@Override
getTargetback to summary
public Object getTarget()

Implements javax.cache.annotation.CacheInvocationContext.getTarget, org.springframework.cache.interceptor.CacheOperationInvocationContext.getTarget.

Doc from org.springframework.cache.interceptor.CacheOperationInvocationContext.getTarget.

Return the target instance on which the method was invoked.

Returns:Object

Doc from javax.cache.annotation.CacheInvocationContext.getTarget.

The object the intercepted method was invoked on.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
unwrapback to summary
public <T> T unwrap(Class<T> cls)

Implements javax.cache.annotation.CacheInvocationContext.unwrap.

Doc from javax.cache.annotation.CacheInvocationContext.unwrap.

Return an object of the specified type to allow access to the provider-specific API. If the provider's implementation does not support the specified class, the IllegalArgumentException is thrown.

Parameters
<T>
The type of the expected underlying javax.cache.Cache implementation.
cls:Class<T>

the class of the object to be returned. This is normally either the underlying implementation class or an interface that it implements.

Returns:T

an instance of the specified class

Annotations
@Override