1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.jcs3.jcache.cdi;
20
21 import javax.cache.annotation.CacheInvocationParameter;
22 import javax.cache.annotation.CacheKeyGenerator;
23 import javax.cache.annotation.CacheKeyInvocationContext;
24 import javax.cache.annotation.GeneratedCacheKey;
25 import java.lang.annotation.Annotation;
26
27 public class CacheKeyGeneratorImpl implements CacheKeyGenerator
28 {
29 @Override
30 public GeneratedCacheKey generateCacheKey(final CacheKeyInvocationContext<? extends Annotation> cacheKeyInvocationContext)
31 {
32 final CacheInvocationParameter[] keyParameters = cacheKeyInvocationContext.getKeyParameters();
33 final Object[] parameters = new Object[keyParameters.length];
34 for (int index = 0; index < keyParameters.length; index++)
35 {
36 parameters[index] = keyParameters[index].getValue();
37 }
38 return new GeneratedCacheKeyImpl(parameters);
39 }
40 }