Java Code Examples for javax.cache.annotation.CacheDefaults#cacheKeyGenerator()

The following examples show how to use javax.cache.annotation.CacheDefaults#cacheKeyGenerator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CDIJCacheHelper.java    From commons-jcs with Apache License 2.0 6 votes vote down vote up
private CacheKeyGenerator cacheKeyGeneratorFor(final CacheDefaults defaults, final Class<? extends CacheKeyGenerator> cacheKeyGenerator)
{
    if (!CacheKeyGenerator.class.equals(cacheKeyGenerator))
    {
        return instance(cacheKeyGenerator);
    }
    if (defaults != null)
    {
        final Class<? extends CacheKeyGenerator> defaultCacheKeyGenerator = defaults.cacheKeyGenerator();
        if (!CacheKeyGenerator.class.equals(defaultCacheKeyGenerator))
        {
            return instance(defaultCacheKeyGenerator);
        }
    }
    return defaultCacheKeyGenerator;
}
 
Example 2
Source File: AnnotationJCacheOperationSource.java    From spring-analysis-note with MIT License 5 votes vote down vote up
protected KeyGenerator determineKeyGenerator(
		@Nullable CacheDefaults defaults, Class<? extends CacheKeyGenerator> candidate) {

	if (candidate != CacheKeyGenerator.class) {
		return new KeyGeneratorAdapter(this, getBean(candidate));
	}
	else if (defaults != null && CacheKeyGenerator.class != defaults.cacheKeyGenerator()) {
		return new KeyGeneratorAdapter(this, getBean(defaults.cacheKeyGenerator()));
	}
	else {
		return getDefaultKeyGenerator();
	}
}
 
Example 3
Source File: AnnotationJCacheOperationSource.java    From java-technology-stack with MIT License 5 votes vote down vote up
protected KeyGenerator determineKeyGenerator(
		@Nullable CacheDefaults defaults, Class<? extends CacheKeyGenerator> candidate) {

	if (candidate != CacheKeyGenerator.class) {
		return new KeyGeneratorAdapter(this, getBean(candidate));
	}
	else if (defaults != null && CacheKeyGenerator.class != defaults.cacheKeyGenerator()) {
		return new KeyGeneratorAdapter(this, getBean(defaults.cacheKeyGenerator()));
	}
	else {
		return getDefaultKeyGenerator();
	}
}
 
Example 4
Source File: AnnotationJCacheOperationSource.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected KeyGenerator determineKeyGenerator(CacheDefaults defaults, Class<? extends CacheKeyGenerator> candidate) {
	if (CacheKeyGenerator.class != candidate) {
		return new KeyGeneratorAdapter(this, getBean(candidate));
	}
	else if (defaults != null && CacheKeyGenerator.class != defaults.cacheKeyGenerator()) {
		return new KeyGeneratorAdapter(this, getBean(defaults.cacheKeyGenerator()));
	}
	else {
		return getDefaultKeyGenerator();
	}
}
 
Example 5
Source File: AnnotationJCacheOperationSource.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
protected KeyGenerator determineKeyGenerator(CacheDefaults defaults, Class<? extends CacheKeyGenerator> candidate) {
	if (CacheKeyGenerator.class != candidate) {
		return new KeyGeneratorAdapter(this, getBean(candidate));
	}
	else if (defaults != null && CacheKeyGenerator.class != defaults.cacheKeyGenerator()) {
		return new KeyGeneratorAdapter(this, getBean(defaults.cacheKeyGenerator()));
	}
	else {
		return getDefaultKeyGenerator();
	}
}