Package org.infinispan.jcache.annotation
Class CacheLookupHelper
- java.lang.Object
-
- org.infinispan.jcache.annotation.CacheLookupHelper
-
public final class CacheLookupHelper extends Object
An helper class providing useful methods for cache lookup.- Author:
- Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.cache.annotation.CacheKeyGeneratorgetCacheKeyGenerator(javax.enterprise.inject.spi.BeanManager beanManager, Class<? extends javax.cache.annotation.CacheKeyGenerator> methodCacheKeyGeneratorClass, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation)Resolves and creates an instance ofCacheKeyGenerator.static StringgetCacheName(Method method, String methodCacheName, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation, boolean generate)Resolves the cache name of a method annotated with a JCACHE annotation.static javax.cache.annotation.CacheResolverFactorygetCacheResolverFactory(javax.enterprise.inject.spi.BeanManager beanManager, Class<? extends javax.cache.annotation.CacheResolverFactory> methodCacheResolverFactoryClass, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation)Resolves and creates an instance ofCacheResolverFactory.
-
-
-
Method Detail
-
getCacheName
public static String getCacheName(Method method, String methodCacheName, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation, boolean generate)
Resolves the cache name of a method annotated with a JCACHE annotation.- Parameters:
method- the annotated method.methodCacheName- the cache name defined on the JCACHE annotation.cacheDefaultsAnnotation- theCacheDefaultsannotation instance.generate-trueif the default cache name has to be returned if none is specified.- Returns:
- the resolved cache name.
- Throws:
NullPointerException- if method or methodCacheName parameter isnull.
-
getCacheKeyGenerator
public static javax.cache.annotation.CacheKeyGenerator getCacheKeyGenerator(javax.enterprise.inject.spi.BeanManager beanManager, Class<? extends javax.cache.annotation.CacheKeyGenerator> methodCacheKeyGeneratorClass, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation)Resolves and creates an instance ofCacheKeyGenerator. To resolve the cache key generator class the algorithm defined in JCACHE specification is used.- Parameters:
beanManager- the bean manager instance.methodCacheKeyGeneratorClass- theCacheKeyGeneratorclass declared in the cache annotation.cacheDefaultsAnnotation- theCacheDefaultsannotation instance.- Returns:
- the
CacheKeyGeneratorinstance. - Throws:
NullPointerException- if beanManager parameter isnull.
-
getCacheResolverFactory
public static javax.cache.annotation.CacheResolverFactory getCacheResolverFactory(javax.enterprise.inject.spi.BeanManager beanManager, Class<? extends javax.cache.annotation.CacheResolverFactory> methodCacheResolverFactoryClass, javax.cache.annotation.CacheDefaults cacheDefaultsAnnotation)Resolves and creates an instance ofCacheResolverFactory. To resolve the cache resolver factory class the algorithm defined in JCACHE specification is used.- Parameters:
beanManager- the bean manager instance.methodCacheResolverFactoryClass- theCacheResolverFactoryclass declared in the cache annotation.cacheDefaultsAnnotation- theCacheDefaultsannotation instance.- Returns:
- the
CacheResolverFactoryinstance. - Throws:
NullPointerException- if beanManager parameter isnull.
-
-