Class MethodMapTransactionAttributeSource
java.lang.Object
org.springframework.transaction.interceptor.MethodMapTransactionAttributeSource
- All Implemented Interfaces:
- Aware,- BeanClassLoaderAware,- InitializingBean,- EmbeddedValueResolverAware,- TransactionAttributeSource
public class MethodMapTransactionAttributeSource
extends Object
implements TransactionAttributeSource, EmbeddedValueResolverAware, BeanClassLoaderAware, InitializingBean
Simple 
TransactionAttributeSource implementation that
 allows attributes to be stored per method in a Map.- Since:
- 24.04.2003
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddTransactionalMethod(Class<?> clazz, String mappedName, TransactionAttribute attr) Add an attribute for a transactional method.voidaddTransactionalMethod(Method method, TransactionAttribute attr) Add an attribute for a transactional method.voidaddTransactionalMethod(String name, TransactionAttribute attr) Add an attribute for a transactional method.voidEagerly initializes the specified"methodMap", if any.booleangetTransactionAttribute(Method method, Class<?> targetClass) Return the transaction attribute for the given method, ornullif the method is non-transactional.inthashCode()protected voidinitMethodMap(Map<String, TransactionAttribute> methodMap) Initialize the specified"methodMap", if any.protected booleanReturn if the given method name matches the mapped name.voidsetBeanClassLoader(ClassLoader beanClassLoader) Callback that supplies the beanclass loaderto a bean instance.voidsetEmbeddedValueResolver(StringValueResolver resolver) Set the StringValueResolver to use for resolving embedded definition values.voidsetMethodMap(Map<String, TransactionAttribute> methodMap) Set a name/attribute map, consisting of "FQCN.method" method names (e.g.toString()Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.transaction.interceptor.TransactionAttributeSourceisCandidateClass
- 
Field Details- 
loggerLogger available to subclasses.
 
- 
- 
Constructor Details- 
MethodMapTransactionAttributeSourcepublic MethodMapTransactionAttributeSource()
 
- 
- 
Method Details- 
setMethodMapSet a name/attribute map, consisting of "FQCN.method" method names (e.g. "com.mycompany.mycode.MyClass.myMethod") andTransactionAttributeinstances (or Strings to be converted toTransactionAttributeinstances).Intended for configuration via setter injection, typically within a Spring bean factory. Relies on afterPropertiesSet()being called afterwards.- Parameters:
- methodMap- said- Mapfrom method name to attribute value
- See Also:
 
- 
setEmbeddedValueResolverDescription copied from interface:EmbeddedValueResolverAwareSet the StringValueResolver to use for resolving embedded definition values.- Specified by:
- setEmbeddedValueResolverin interface- EmbeddedValueResolverAware
 
- 
setBeanClassLoaderDescription copied from interface:BeanClassLoaderAwareCallback that supplies the beanclass loaderto a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean'sInitializingBean.afterPropertiesSet()method or a custom init-method.- Specified by:
- setBeanClassLoaderin interface- BeanClassLoaderAware
- Parameters:
- beanClassLoader- the owning class loader
 
- 
afterPropertiesSetpublic void afterPropertiesSet()Eagerly initializes the specified"methodMap", if any.- Specified by:
- afterPropertiesSetin interface- InitializingBean
- See Also:
 
- 
initMethodMapInitialize the specified"methodMap", if any.- Parameters:
- methodMap- a Map from method names to- TransactionAttributeinstances
- See Also:
 
- 
addTransactionalMethodAdd an attribute for a transactional method.Method names can end or start with "*" for matching multiple methods. - Parameters:
- name- class and method name, separated by a dot
- attr- attribute associated with the method
- Throws:
- IllegalArgumentException- in case of an invalid name
 
- 
addTransactionalMethodAdd an attribute for a transactional method. Method names can end or start with "*" for matching multiple methods.- Parameters:
- clazz- target interface or class
- mappedName- mapped method name
- attr- attribute associated with the method
 
- 
addTransactionalMethodAdd an attribute for a transactional method.- Parameters:
- method- the method
- attr- attribute associated with the method
 
- 
isMatchReturn if the given method name matches the mapped name.The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. - Parameters:
- methodName- the method name of the class
- mappedName- the name in the descriptor
- Returns:
- if the names match
- See Also:
 
- 
getTransactionAttribute@Nullable public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) Description copied from interface:TransactionAttributeSourceReturn the transaction attribute for the given method, ornullif the method is non-transactional.- Specified by:
- getTransactionAttributein interface- TransactionAttributeSource
- Parameters:
- method- the method to introspect
- targetClass- the target class (can be- null, in which case the declaring class of the method must be used)
- Returns:
- the matching transaction attribute, or nullif none found
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-