Annotation Type CacheDefaults
-
@Target(TYPE) @Retention(RUNTIME) public @interface CacheDefaults
Allows the configuration of defaults forCacheResult
,CachePut
,CacheRemove
, andCacheRemoveAll
at 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>
cacheKeyGenerator
TheCacheKeyGenerator
to use to generate theGeneratedCacheKey
for interacting with the specified Cache.java.lang.String
cacheName
The default name of the cache for the annotated classjava.lang.Class<? extends CacheResolverFactory>
cacheResolverFactory
TheCacheResolverFactory
used to find theCacheResolver
to 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
TheCacheResolverFactory
used to find theCacheResolver
to use at runtime.The default resolver pair will resolve the cache by name from the default
CacheManager
Applicable for
CacheResult
,CachePut
,CacheRemove
, andCacheRemoveAll
- Default:
- javax.cache.annotation.CacheResolverFactory.class
-
-
-
cacheKeyGenerator
java.lang.Class<? extends CacheKeyGenerator> cacheKeyGenerator
TheCacheKeyGenerator
to use to generate theGeneratedCacheKey
for 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
-
-