public class MethodMapTransactionAttributeSource extends Object implements TransactionAttributeSource, BeanClassLoaderAware, InitializingBean
TransactionAttributeSource implementation that
 allows attributes to be stored per method in a Map.isMatch(java.lang.String, java.lang.String), 
NameMatchTransactionAttributeSource| Modifier and Type | Field and Description | 
|---|---|
protected Log | 
logger
Logger available to subclasses 
 | 
| Constructor and Description | 
|---|
MethodMapTransactionAttributeSource()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addTransactionalMethod(Class<?> clazz,
                      String mappedName,
                      TransactionAttribute attr)
Add an attribute for a transactional method. 
 | 
void | 
addTransactionalMethod(Method method,
                      TransactionAttribute attr)
Add an attribute for a transactional method. 
 | 
void | 
addTransactionalMethod(String name,
                      TransactionAttribute attr)
Add an attribute for a transactional method. 
 | 
void | 
afterPropertiesSet()
Eagerly initializes the specified
  
"methodMap", if any. | 
boolean | 
equals(Object other)  | 
TransactionAttribute | 
getTransactionAttribute(Method method,
                       Class<?> targetClass)
Return the transaction attribute for the given method,
 or  
null if the method is non-transactional. | 
int | 
hashCode()  | 
protected void | 
initMethodMap(Map<String,TransactionAttribute> methodMap)
Initialize the specified  
"methodMap", if any. | 
protected boolean | 
isMatch(String methodName,
       String mappedName)
Return if the given method name matches the mapped name. 
 | 
void | 
setBeanClassLoader(ClassLoader beanClassLoader)
Callback that supplies the bean  
class loader to
 a bean instance. | 
void | 
setMethodMap(Map<String,TransactionAttribute> methodMap)
Set a name/attribute map, consisting of "FQCN.method" method names
 (e.g. 
 | 
String | 
toString()  | 
protected final Log logger
public void setMethodMap(Map<String,TransactionAttribute> methodMap)
TransactionAttribute instances (or Strings to be converted
 to TransactionAttribute instances).
 Intended for configuration via setter injection, typically within
 a Spring bean factory. Relies on afterPropertiesSet()
 being called afterwards.
methodMap - said Map from method name to attribute valueTransactionAttribute, 
TransactionAttributeEditorpublic void setBeanClassLoader(ClassLoader beanClassLoader)
BeanClassLoaderAwareclass loader to
 a bean instance.
 Invoked after the population of normal bean properties but
 before an initialization callback such as
 InitializingBean's
 InitializingBean.afterPropertiesSet()
 method or a custom init-method.
setBeanClassLoader in interface BeanClassLoaderAwarebeanClassLoader - the owning class loader; may be null in
 which case a default ClassLoader must be used, for example
 the ClassLoader obtained via
 ClassUtils.getDefaultClassLoader()public void afterPropertiesSet()
"methodMap", if any.afterPropertiesSet in interface InitializingBeaninitMethodMap(java.util.Map)protected void initMethodMap(Map<String,TransactionAttribute> methodMap)
"methodMap", if any.methodMap - Map from method names to TransactionAttribute instancessetMethodMap(java.util.Map<java.lang.String, org.springframework.transaction.interceptor.TransactionAttribute>)public void addTransactionalMethod(String name, TransactionAttribute attr)
Method names can end or start with "*" for matching multiple methods.
name - class and method name, separated by a dotattr - attribute associated with the methodIllegalArgumentException - in case of an invalid namepublic void addTransactionalMethod(Class<?> clazz, String mappedName, TransactionAttribute attr)
clazz - target interface or classmappedName - mapped method nameattr - attribute associated with the methodpublic void addTransactionalMethod(Method method, TransactionAttribute attr)
method - the methodattr - attribute associated with the methodprotected boolean isMatch(String methodName, String mappedName)
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality.
methodName - the method name of the classmappedName - the name in the descriptorPatternMatchUtils.simpleMatch(String, String)public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass)
TransactionAttributeSourcenull if the method is non-transactional.getTransactionAttribute in interface TransactionAttributeSourcemethod - 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 found