public class NameMatchCacheOperationSource extends Object implements CacheOperationSource, Serializable
CacheOperationSource
implementation that allows attributes to be matched
by registered name.Modifier and Type | Field and Description |
---|---|
protected static Log |
logger
Logger available to subclasses.
|
Constructor and Description |
---|
NameMatchCacheOperationSource() |
Modifier and Type | Method and Description |
---|---|
void |
addCacheMethod(String methodName,
Collection<CacheOperation> ops)
Add an attribute for a cacheable method.
|
boolean |
equals(Object other) |
Collection<CacheOperation> |
getCacheOperations(Method method,
Class<?> targetClass)
Return the collection of cache operations for this method,
or
null if the method contains no cacheable annotations. |
int |
hashCode() |
protected boolean |
isMatch(String methodName,
String mappedName)
Return if the given method name matches the mapped name.
|
void |
setNameMap(Map<String,Collection<CacheOperation>> nameMap)
Set a name/attribute map, consisting of method names
(e.g.
|
String |
toString() |
protected static final Log logger
Static for optimal serialization.
public void setNameMap(Map<String,Collection<CacheOperation>> nameMap)
CacheOperation
public void addCacheMethod(String methodName, Collection<CacheOperation> ops)
Method names can be exact matches, or of the pattern "xxx*", "*xxx" or "*xxx*" for matching multiple methods.
methodName
- the name of the methodops
- operation associated with the methodpublic Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass)
CacheOperationSource
null
if the method contains no cacheable annotations.getCacheOperations
in interface CacheOperationSource
method
- the method to introspecttargetClass
- the target class (may be null
, in which case
the declaring class of the method must be used)null
if none foundprotected boolean isMatch(String methodName, String mappedName)
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
methodName
- the method name of the classmappedName
- the name in the descriptorPatternMatchUtils.simpleMatch(String, String)