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

pack-priv Class KeyGeneratorAdapter

extends Object
implements KeyGenerator
Class Inheritance
All Implemented Interfaces
org.springframework.cache.interceptor.KeyGenerator
Imports
java.lang.annotation.Annotation, java.lang.reflect.Method, java.util.ArrayList, .List, javax.cache.annotation.CacheInvocationParameter, .CacheKeyGenerator, .CacheKeyInvocationContext, org.springframework.cache.interceptor.KeyGenerator, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils

Spring's KeyGenerator implementation that either delegates to a standard JSR-107 javax.cache.annotation.CacheKeyGenerator, or wrap a standard KeyGenerator so that only relevant parameters are handled.
Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1

Field Summary

Modifier and TypeField and Description
private CacheKeyGenerator
private final JCacheOperationSource
private KeyGenerator

Constructor Summary

AccessConstructor and Description
public
KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, KeyGenerator target)

Create an instance with the given KeyGenerator so that javax.cache.annotation.CacheKey and javax.cache.annotation.CacheValue are handled according to the spec.

public
KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, CacheKeyGenerator target)

Create an instance used to wrap the specified javax.cache.annotation.CacheKeyGenerator.

Method Summary

Modifier and TypeMethod and Description
private CacheKeyInvocationContext<?>
private static Object
public Object
generate(Object
the target instance
target
,
Method
the method being called
method
,
Object...
the method parameters (with any var-args expanded)
params
)

Implements org.springframework.cache.interceptor.KeyGenerator.generate.

Generate a key for the given method and its parameters.

public Object
getTarget()

Return the target key generator to use in the form of either a KeyGenerator or a CacheKeyGenerator.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheKeyGeneratorback to summary
private CacheKeyGenerator cacheKeyGenerator
Annotations
@Nullable
cacheOperationSourceback to summary
private final JCacheOperationSource cacheOperationSource
keyGeneratorback to summary
private KeyGenerator keyGenerator
Annotations
@Nullable

Constructor Detail

KeyGeneratorAdapterback to summary
public KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, KeyGenerator target)

Create an instance with the given KeyGenerator so that javax.cache.annotation.CacheKey and javax.cache.annotation.CacheValue are handled according to the spec.

KeyGeneratorAdapterback to summary
public KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, CacheKeyGenerator target)

Create an instance used to wrap the specified javax.cache.annotation.CacheKeyGenerator.

Method Detail

createCacheKeyInvocationContextback to summary
private CacheKeyInvocationContext<?> createCacheKeyInvocationContext(Object target, JCacheOperation<?> operation, Object[] params)
Annotations
@SuppressWarnings:unchecked
doGenerateback to summary
private static Object doGenerate(KeyGenerator keyGenerator, CacheKeyInvocationContext<?> context)
generateback to summary
public Object generate(Object target, Method method, Object... params)

Implements org.springframework.cache.interceptor.KeyGenerator.generate.

Doc from org.springframework.cache.interceptor.KeyGenerator.generate.

Generate a key for the given method and its parameters.

Parameters
target:Object

the target instance

method:Method

the method being called

params:Object[]

the method parameters (with any var-args expanded)

Returns:Object

a generated key

Annotations
@Override
getTargetback to summary
public Object getTarget()

Return the target key generator to use in the form of either a KeyGenerator or a CacheKeyGenerator.