@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2016 the original author or authors .
* Copyright 2002 - 2018 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -29,10 +29,9 @@ import org.springframework.util.Assert;
@@ -29,10 +29,9 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils ;
/ * *
* Spring ' s { @link KeyGenerator } implementation that either delegates to a
* standard JSR - 107 { @link javax . cache . annotation . CacheKeyGenerator } , or
* wrap a standard { @link KeyGenerator } so that only relevant parameters
* are handled .
* Spring ' s { @link KeyGenerator } implementation that either delegates to a standard JSR - 107
* { @link javax . cache . annotation . CacheKeyGenerator } , or wrap a standard { @link KeyGenerator }
* so that only relevant parameters are handled .
*
* @author Stephane Nicoll
* @since 4 . 1
@ -45,12 +44,13 @@ class KeyGeneratorAdapter implements KeyGenerator {
@@ -45,12 +44,13 @@ class KeyGeneratorAdapter implements KeyGenerator {
private CacheKeyGenerator cacheKeyGenerator ;
/ * *
* Create an instance with the given { @link KeyGenerator } so that { @link javax . cache . annotation . CacheKey }
* and { @link javax . cache . annotation . CacheValue } are handled according to the spec .
* /
public KeyGeneratorAdapter ( JCacheOperationSource cacheOperationSource , KeyGenerator target ) {
Assert . notNull ( cacheOperationSource , "cacheOperationSource must not be null. " ) ;
Assert . notNull ( cacheOperationSource , "JCacheOperationSource must not be null " ) ;
Assert . notNull ( target , "KeyGenerator must not be null" ) ;
this . cacheOperationSource = cacheOperationSource ;
this . keyGenerator = target ;
@ -60,12 +60,13 @@ class KeyGeneratorAdapter implements KeyGenerator {
@@ -60,12 +60,13 @@ class KeyGeneratorAdapter implements KeyGenerator {
* Create an instance used to wrap the specified { @link javax . cache . annotation . CacheKeyGenerator } .
* /
public KeyGeneratorAdapter ( JCacheOperationSource cacheOperationSource , CacheKeyGenerator target ) {
Assert . notNull ( cacheOperationSource , "cacheOperationSource must not be null. " ) ;
Assert . notNull ( target , "KeyGenerator must not be null" ) ;
Assert . notNull ( cacheOperationSource , "JCacheOperationSource must not be null " ) ;
Assert . notNull ( target , "Cache KeyGenerator must not be null" ) ;
this . cacheOperationSource = cacheOperationSource ;
this . cacheKeyGenerator = target ;
}
/ * *
* Return the target key generator to use in the form of either a { @link KeyGenerator }
* or a { @link CacheKeyGenerator } .
@ -74,7 +75,6 @@ class KeyGeneratorAdapter implements KeyGenerator {
@@ -74,7 +75,6 @@ class KeyGeneratorAdapter implements KeyGenerator {
return ( this . keyGenerator ! = null ? this . keyGenerator : this . cacheKeyGenerator ) ;
}
@Override
public Object generate ( Object target , Method method , Object . . . params ) {
JCacheOperation < ? > operation = this . cacheOperationSource . getCacheOperation ( method , target . getClass ( ) ) ;