1 package org.springframework.cache.jcache.support;
2
3 import java.lang.annotation.Annotation;
4 import javax.cache.annotation.CacheKeyGenerator;
5 import javax.cache.annotation.CacheKeyInvocationContext;
6 import javax.cache.annotation.GeneratedCacheKey;
7
8 import org.springframework.cache.interceptor.SimpleKey;
9
10
11
12
13
14
15
16
17 public class TestableCacheKeyGenerator implements CacheKeyGenerator {
18
19 @Override
20 public GeneratedCacheKey generateCacheKey(CacheKeyInvocationContext<? extends Annotation> context) {
21 return new SimpleGeneratedCacheKey(context.getKeyParameters()[0]);
22 }
23
24
25 @SuppressWarnings("serial")
26 private static class SimpleGeneratedCacheKey extends SimpleKey implements GeneratedCacheKey {
27
28 public SimpleGeneratedCacheKey(Object... elements) {
29 super(elements);
30 }
31
32 }
33
34 }