1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.jcs.jcache.cdi;
20
21 import java.lang.annotation.Annotation;
22
23 import javax.cache.annotation.CacheInvocationParameter;
24 import javax.cache.annotation.CacheKeyInvocationContext;
25 import javax.interceptor.InvocationContext;
26
27 public class CacheKeyInvocationContextImpl<A extends Annotation> extends CacheInvocationContextImpl<A> implements CacheKeyInvocationContext<A>
28 {
29 private CacheInvocationParameter[] keyParams = null;
30 private CacheInvocationParameter valueParam = null;
31
32 public CacheKeyInvocationContextImpl(final InvocationContext delegate, final A annotation, final String name,
33 final CDIJCacheHelper.MethodMeta methodMeta)
34 {
35 super(delegate, annotation, name, methodMeta);
36 }
37
38 @Override
39 public CacheInvocationParameter[] getKeyParameters()
40 {
41 if (keyParams == null)
42 {
43 keyParams = doGetAllParameters(meta.getKeysIndices());
44 }
45 return keyParams;
46 }
47
48 @Override
49 public CacheInvocationParameter getValueParameter()
50 {
51 if (valueParam == null)
52 {
53 valueParam = meta.getValueIndex() >= 0 ? doGetAllParameters(new Integer[]{meta.getValueIndex()})[0] : null;
54 }
55 return valueParam;
56 }
57 }