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

pack-priv Class DefaultCacheKeyInvocationContext<A extends Annotation>

extends DefaultCacheInvocationContext<A extends Annotation>
implements CacheKeyInvocationContext<A extends Annotation>
Class Inheritance
All Implemented Interfaces
javax.cache.annotation.CacheKeyInvocationContext, javax.cache.annotation.CacheInvocationContext, javax.cache.annotation.CacheMethodDetails
Type Parameters
<A>
the annotation type
Imports
java.lang.annotation.Annotation, javax.cache.annotation.CacheInvocationParameter, .CacheKeyInvocationContext, org.springframework.lang.Nullable

The default CacheKeyInvocationContext implementation.
Author
Stephane Nicoll
Since
4.1

Field Summary

Modifier and TypeField and Description
private final CacheInvocationParameter[]
private final CacheInvocationParameter

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Implements javax.cache.annotation.CacheKeyInvocationContext.getKeyParameters.

Returns a clone of the array of all method parameters to be used by the CacheKeyGenerator in creating a GeneratedCacheKey.

public CacheInvocationParameter
getValueParameter()

Implements javax.cache.annotation.CacheKeyInvocationContext.getValueParameter.

When a method is annotated with CachePut this is the parameter annotated with CacheValue

Inherited from org.springframework.cache.jcache.interceptor.DefaultCacheInvocationContext:
getAllParametersgetAnnotationsgetArgsgetCacheAnnotationgetCacheNamegetMethodgetOperationgetTargettoStringunwrap

Field Detail

keyParametersback to summary
private final CacheInvocationParameter[] keyParameters
valueParameterback to summary
private final CacheInvocationParameter valueParameter
Annotations
@Nullable

Constructor Detail

DefaultCacheKeyInvocationContextback to summary
public DefaultCacheKeyInvocationContext(AbstractJCacheKeyOperation<A> operation, Object target, Object[] args)

Method Detail

getKeyParametersback to summary
public CacheInvocationParameter[] getKeyParameters()

Implements javax.cache.annotation.CacheKeyInvocationContext.getKeyParameters.

Doc from javax.cache.annotation.CacheKeyInvocationContext.getKeyParameters.

Returns a clone of the array of all method parameters to be used by the CacheKeyGenerator in creating a GeneratedCacheKey. The returned array may be the same as or a subset of the array returned by getAllParameters()

Parameters in this array are selected by the following rules:

  • If no parameters are annotated with CacheKey or CacheValue then all parameters are included
  • If a CacheValue annotation exists and no CacheKey then all parameters except the one annotated with CacheValue are included
  • If one or more CacheKey annotations exist only those parameters with the CacheKey annotation are included
Returns:CacheInvocationParameter[]

An array of all parameters to be used in cache key generation

Annotations
@Override
getValueParameterback to summary
public CacheInvocationParameter getValueParameter()

Implements javax.cache.annotation.CacheKeyInvocationContext.getValueParameter.

Doc from javax.cache.annotation.CacheKeyInvocationContext.getValueParameter.

When a method is annotated with CachePut this is the parameter annotated with CacheValue

Returns:CacheInvocationParameter

The parameter to cache, will never be null for methods annotated with CachePut, will be null for methods not annotated with CachePut

Annotations
@Override
@Nullable