public class NameMatchCacheOperationSource extends java.lang.Object implements CacheOperationSource, java.io.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(java.lang.String methodName,
java.util.Collection<CacheOperation> ops)
Add an attribute for a cacheable method.
|
boolean |
equals(java.lang.Object other) |
java.util.Collection<CacheOperation> |
getCacheOperations(java.lang.reflect.Method method,
java.lang.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(java.lang.String methodName,
java.lang.String mappedName)
Return if the given method name matches the mapped name.
|
void |
setNameMap(java.util.Map<java.lang.String,java.util.Collection<CacheOperation>> nameMap)
Set a name/attribute map, consisting of method names
(e.g.
|
java.lang.String |
toString() |
protected static final Log logger
Static for optimal serialization.
public void setNameMap(java.util.Map<java.lang.String,java.util.Collection<CacheOperation>> nameMap)
CacheOperationpublic void addCacheMethod(java.lang.String methodName,
java.util.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 java.util.Collection<CacheOperation> getCacheOperations(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
CacheOperationSourcenull
if the method contains no cacheable annotations.getCacheOperations in interface CacheOperationSourcemethod - 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(java.lang.String methodName,
java.lang.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)public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object