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

public Class CompositeCacheOperationSource

extends Object
implements CacheOperationSource, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.cache.interceptor.CacheOperationSource
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.lang.reflect.Method, java.util.ArrayList, .Collection, org.springframework.lang.Nullable, org.springframework.util.Assert

Composite CacheOperationSource implementation that iterates over a given array of CacheOperationSource instances.
Authors
Costin Leau, Juergen Hoeller
Since
3.1

Field Summary

Modifier and TypeField and Description
private final CacheOperationSource[]

Constructor Summary

AccessConstructor and Description
public
CompositeCacheOperationSource(CacheOperationSource...
the CacheOperationSource instances to combine
cacheOperationSources
)

Create a new CompositeCacheOperationSource for the given sources.

Method Summary

Modifier and TypeMethod and Description
public Collection<CacheOperation>
getCacheOperations(Method
the method to introspect
method
,
Class<?>
the target class (may be null, in which case the declaring class of the method must be used)
targetClass
)

Implements org.springframework.cache.interceptor.CacheOperationSource.getCacheOperations.

Return the collection of cache operations for this method, or null if the method contains no cacheable annotations.
public final CacheOperationSource[]
getCacheOperationSources()

Return the CacheOperationSource instances that this CompositeCacheOperationSource combines.

public boolean
isCandidateClass(Class<?>
the class to introspect
targetClass
)

Overrides default org.springframework.cache.interceptor.CacheOperationSource.isCandidateClass.

Determine whether the given class is a candidate for cache operations in the metadata format of this CacheOperationSource.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheOperationSourcesback to summary
private final CacheOperationSource[] cacheOperationSources

Constructor Detail

CompositeCacheOperationSourceback to summary
public CompositeCacheOperationSource(CacheOperationSource... cacheOperationSources)

Create a new CompositeCacheOperationSource for the given sources.

Parameters
cacheOperationSources:CacheOperationSource[]

the CacheOperationSource instances to combine

Method Detail

getCacheOperationsback to summary
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass)

Implements org.springframework.cache.interceptor.CacheOperationSource.getCacheOperations.

Doc from org.springframework.cache.interceptor.CacheOperationSource.getCacheOperations.

Return the collection of cache operations for this method, or null if the method contains no cacheable annotations.

Parameters
method:Method

the method to introspect

targetClass:Class<?>

the target class (may be null, in which case the declaring class of the method must be used)

Returns:Collection<CacheOperation>

all cache operations for this method, or null if none found

Annotations
@Override
@Nullable
getCacheOperationSourcesback to summary
public final CacheOperationSource[] getCacheOperationSources()

Return the CacheOperationSource instances that this CompositeCacheOperationSource combines.

isCandidateClassback to summary
public boolean isCandidateClass(Class<?> targetClass)

Overrides default org.springframework.cache.interceptor.CacheOperationSource.isCandidateClass.

Doc from org.springframework.cache.interceptor.CacheOperationSource.isCandidateClass.

Determine whether the given class is a candidate for cache operations in the metadata format of this CacheOperationSource.

If this method returns false, the methods on the given class will not get traversed for getCacheOperations introspection. Returning false is therefore an optimization for non-affected classes, whereas true simply means that the class needs to get fully introspected for each method on the given class individually.

Parameters
targetClass:Class<?>

the class to introspect

Returns:boolean

false if the class is known to have no cache operation metadata at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.

Annotations
@Override