in commons-jcs3-jcache/src/main/java/org/apache/commons/jcs3/jcache/cdi/CDIJCacheHelper.java [117:184]
private MethodMeta createMeta(final InvocationContext ic)
{
final CacheDefaults defaults = findDefaults(ic.getTarget() == null ? null : ic.getTarget()
.getClass(), ic.getMethod());
final Class<?>[] parameterTypes = ic.getMethod().getParameterTypes();
final Annotation[][] parameterAnnotations = ic.getMethod().getParameterAnnotations();
final List<Set<Annotation>> annotations = new ArrayList<>();
for (final Annotation[] parameterAnnotation : parameterAnnotations)
{
final Set<Annotation> set = new HashSet<>(parameterAnnotation.length);
set.addAll(Arrays.asList(parameterAnnotation));
annotations.add(set);
}
final Set<Annotation> mtdAnnotations = new HashSet<>(Arrays.asList(ic.getMethod().getAnnotations()));
final CacheResult cacheResult = ic.getMethod().getAnnotation(CacheResult.class);
final String cacheResultCacheResultName = cacheResult == null ? null : defaultName(ic.getMethod(), defaults, cacheResult.cacheName());
final CacheResolverFactory cacheResultCacheResolverFactory = cacheResult == null ?
null : cacheResolverFactoryFor(defaults, cacheResult.cacheResolverFactory());
final CacheKeyGenerator cacheResultCacheKeyGenerator = cacheResult == null ?
null : cacheKeyGeneratorFor(defaults, cacheResult.cacheKeyGenerator());
final CachePut cachePut = ic.getMethod().getAnnotation(CachePut.class);
final String cachePutCachePutName = cachePut == null ? null : defaultName(ic.getMethod(), defaults, cachePut.cacheName());
final CacheResolverFactory cachePutCacheResolverFactory = cachePut == null ?
null : cacheResolverFactoryFor(defaults, cachePut.cacheResolverFactory());
final CacheKeyGenerator cachePutCacheKeyGenerator = cachePut == null ?
null : cacheKeyGeneratorFor(defaults, cachePut.cacheKeyGenerator());
final CacheRemove cacheRemove = ic.getMethod().getAnnotation(CacheRemove.class);
final String cacheRemoveCacheRemoveName = cacheRemove == null ? null : defaultName(ic.getMethod(), defaults, cacheRemove.cacheName());
final CacheResolverFactory cacheRemoveCacheResolverFactory = cacheRemove == null ?
null : cacheResolverFactoryFor(defaults, cacheRemove.cacheResolverFactory());
final CacheKeyGenerator cacheRemoveCacheKeyGenerator = cacheRemove == null ?
null : cacheKeyGeneratorFor(defaults, cacheRemove.cacheKeyGenerator());
final CacheRemoveAll cacheRemoveAll = ic.getMethod().getAnnotation(CacheRemoveAll.class);
final String cacheRemoveAllCacheRemoveAllName = cacheRemoveAll == null ? null : defaultName(ic.getMethod(), defaults, cacheRemoveAll.cacheName());
final CacheResolverFactory cacheRemoveAllCacheResolverFactory = cacheRemoveAll == null ?
null : cacheResolverFactoryFor(defaults, cacheRemoveAll.cacheResolverFactory());
return new MethodMeta(
parameterTypes,
annotations,
mtdAnnotations,
keyParameterIndexes(ic.getMethod()),
getValueParameter(annotations),
getKeyParameters(annotations),
cacheResultCacheResultName,
cacheResultCacheResolverFactory,
cacheResultCacheKeyGenerator,
cacheResult,
cachePutCachePutName,
cachePutCacheResolverFactory,
cachePutCacheKeyGenerator,
cachePut != null && cachePut.afterInvocation(),
cachePut,
cacheRemoveCacheRemoveName,
cacheRemoveCacheResolverFactory,
cacheRemoveCacheKeyGenerator,
cacheRemove != null && cacheRemove.afterInvocation(),
cacheRemove,
cacheRemoveAllCacheRemoveAllName,
cacheRemoveAllCacheResolverFactory,
cacheRemoveAll != null && cacheRemoveAll.afterInvocation(),
cacheRemoveAll);
}