class KeyGeneratorAdapter extends java.lang.Object implements KeyGenerator
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.Modifier and Type | Field and Description |
---|---|
private CacheKeyGenerator |
cacheKeyGenerator |
private JCacheOperationSource |
cacheOperationSource |
private KeyGenerator |
keyGenerator |
Constructor and Description |
---|
KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource,
CacheKeyGenerator target)
Create an instance used to wrap the specified
javax.cache.annotation.CacheKeyGenerator . |
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. |
Modifier and Type | Method and Description |
---|---|
private <any> |
createCacheKeyInvocationContext(java.lang.Object target,
JCacheOperation<?> operation,
java.lang.Object[] params) |
private static java.lang.Object |
doGenerate(KeyGenerator keyGenerator,
<any> context) |
java.lang.Object |
generate(java.lang.Object target,
java.lang.reflect.Method method,
java.lang.Object... params)
Generate a key for the given method and its parameters.
|
java.lang.Object |
getTarget()
Return the target key generator to use in the form of either a
KeyGenerator
or a CacheKeyGenerator . |
private final JCacheOperationSource cacheOperationSource
private KeyGenerator keyGenerator
private CacheKeyGenerator cacheKeyGenerator
public KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, KeyGenerator target)
KeyGenerator
so that javax.cache.annotation.CacheKey
and javax.cache.annotation.CacheValue
are handled according to the spec.public KeyGeneratorAdapter(JCacheOperationSource cacheOperationSource, CacheKeyGenerator target)
javax.cache.annotation.CacheKeyGenerator
.public java.lang.Object getTarget()
KeyGenerator
or a CacheKeyGenerator
.public java.lang.Object generate(java.lang.Object target, java.lang.reflect.Method method, java.lang.Object... params)
KeyGenerator
generate
in interface KeyGenerator
target
- the target instancemethod
- the method being calledparams
- the method parameters (with any var-args expanded)private static java.lang.Object doGenerate(KeyGenerator keyGenerator, <any> context)
private <any> createCacheKeyInvocationContext(java.lang.Object target, JCacheOperation<?> operation, java.lang.Object[] params)