Annotation Type CacheDefaults
-
@Target(TYPE) @Retention(RUNTIME) public @interface CacheDefaultsAllows the configuration of defaults forCacheResult,CachePut,CacheRemove, andCacheRemoveAllat the class level. Without the method level annotations this annotation has no effect.Following is an example of specifying a default cache name that is used by the annotations on the getDomain and deleteDomain methods. The annotation for getAllDomains would use the "allDomains" cache name specified in the method level annotation.
package my.app; @CacheDefaults(cacheName="domainCache") public class DomainDao { @CacheResult public Domain getDomain(String domainId, int index) { ... } @CacheRemove public void deleteDomain(String domainId, int index) { ... } @CacheResult(cacheName="allDomains") public List<Domain> getAllDomains() { ... } }- Since:
- 1.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class<? extends CacheKeyGenerator>cacheKeyGeneratorTheCacheKeyGeneratorto use to generate theGeneratedCacheKeyfor interacting with the specified Cache.java.lang.StringcacheNameThe default name of the cache for the annotated classjava.lang.Class<? extends CacheResolverFactory>cacheResolverFactoryTheCacheResolverFactoryused to find theCacheResolverto use at runtime.
-
-
-
Element Detail
-
cacheName
java.lang.String cacheName
The default name of the cache for the annotated classIf not specified defaults to: package.name.ClassName.methodName(package.ParameterType,package.ParameterType)
Applicable for
CacheResult,CachePut,CacheRemove, andCacheRemoveAll- Default:
- ""
-
-
-
cacheResolverFactory
java.lang.Class<? extends CacheResolverFactory> cacheResolverFactory
TheCacheResolverFactoryused to find theCacheResolverto use at runtime.The default resolver pair will resolve the cache by name from the default
CacheManagerApplicable for
CacheResult,CachePut,CacheRemove, andCacheRemoveAll- Default:
- javax.cache.annotation.CacheResolverFactory.class
-
-
-
cacheKeyGenerator
java.lang.Class<? extends CacheKeyGenerator> cacheKeyGenerator
TheCacheKeyGeneratorto use to generate theGeneratedCacheKeyfor interacting with the specified Cache.Defaults to a key generator that uses
Applicable forArrays.deepHashCode(Object[])andArrays.deepEquals(Object[], Object[])with the array returned byCacheKeyInvocationContext.getKeyParameters()CacheResult,CachePut, andCacheRemove- See Also:
CacheKey
- Default:
- javax.cache.annotation.CacheKeyGenerator.class
-
-