Top Description Fields Constructors Methods
org.springframework.cache.interceptor

public abstract Class AbstractCacheResolver

extends Object
implements CacheResolver, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.cache.interceptor.CacheResolver
Known Direct Subclasses
org.springframework.cache.interceptor.NamedCacheResolver, org.springframework.cache.interceptor.SimpleCacheResolver
Imports
java.util.ArrayList, .Collection, .Collections, org.springframework.beans.factory.InitializingBean, org.springframework.cache.Cache, .CacheManager, org.springframework.lang.Nullable, org.springframework.util.Assert

A base CacheResolver implementation that requires the concrete implementation to provide the collection of cache name(s) based on the invocation context.
Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1

Field Summary

Modifier and TypeField and Description
private CacheManager

Constructor Summary

AccessConstructor and Description
protected
AbstractCacheResolver()

Construct a new AbstractCacheResolver.

protected
AbstractCacheResolver(CacheManager
the CacheManager to use
cacheManager
)

Construct a new AbstractCacheResolver for the given CacheManager.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public CacheManager
getCacheManager()

Return the CacheManager that this instance uses.

protected abstract Collection<String>

Returns:

the cache name(s) to resolve, or null if no cache should be resolved
getCacheNames
(CacheOperationInvocationContext<?>
the context of the particular invocation
context
)

Provide the name of the cache(s) to resolve against the current cache manager.

public Collection<? extends Cache>
resolveCaches(CacheOperationInvocationContext<?>
the context of the particular invocation
context
)

Implements org.springframework.cache.interceptor.CacheResolver.resolveCaches.

Return the cache(s) to use for the specified invocation.

public void
setCacheManager(CacheManager cacheManager)

Set the CacheManager that this instance should use.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheManagerback to summary
private CacheManager cacheManager
Annotations
@Nullable

Constructor Detail

AbstractCacheResolverback to summary
protected AbstractCacheResolver()

Construct a new AbstractCacheResolver.

See Also
setCacheManager
AbstractCacheResolverback to summary
protected AbstractCacheResolver(CacheManager cacheManager)

Construct a new AbstractCacheResolver for the given CacheManager.

Parameters
cacheManager:CacheManager

the CacheManager to use

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
getCacheManagerback to summary
public CacheManager getCacheManager()

Return the CacheManager that this instance uses.

getCacheNamesback to summary
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context)

Provide the name of the cache(s) to resolve against the current cache manager.

It is acceptable to return null to indicate that no cache could be resolved for this invocation.

Parameters
context:CacheOperationInvocationContext<?>

the context of the particular invocation

Returns:Collection<String>

the cache name(s) to resolve, or null if no cache should be resolved

Annotations
@Nullable
resolveCachesback to summary
public Collection<? extends Cache> resolveCaches(CacheOperationInvocationContext<?> context)

Implements org.springframework.cache.interceptor.CacheResolver.resolveCaches.

Doc from org.springframework.cache.interceptor.CacheResolver.resolveCaches.

Return the cache(s) to use for the specified invocation.

Parameters
context:CacheOperationInvocationContext<?>

the context of the particular invocation

Returns:Collection<? extends Cache>

the cache(s) to use (never null)

Annotations
@Override
setCacheManagerback to summary
public void setCacheManager(CacheManager cacheManager)

Set the CacheManager that this instance should use.