Class NameMatchTransactionAttributeSource
java.lang.Object
org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource
- All Implemented Interfaces:
- Serializable,- Aware,- InitializingBean,- EmbeddedValueResolverAware,- TransactionAttributeSource
public class NameMatchTransactionAttributeSource
extends Object
implements TransactionAttributeSource, EmbeddedValueResolverAware, InitializingBean, Serializable
Simple 
TransactionAttributeSource implementation that
 allows attributes to be matched by registered name.- Since:
- 21.08.2003
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddTransactionalMethod(String methodName, TransactionAttribute attr) Add an attribute for a transactional method.voidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.booleangetTransactionAttribute(Method method, Class<?> targetClass) Return the transaction attribute for the given method, ornullif the method is non-transactional.inthashCode()protected booleanDetermine if the given method name matches the mapped name.voidsetEmbeddedValueResolver(StringValueResolver resolver) Set the StringValueResolver to use for resolving embedded definition values.voidsetNameMap(Map<String, TransactionAttribute> nameMap) Set a name/attribute map, consisting of method names (e.g.voidsetProperties(Properties transactionAttributes) Parse the given properties into a name/attribute map.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.Static for optimal serialization. 
 
- 
- 
Constructor Details- 
NameMatchTransactionAttributeSourcepublic NameMatchTransactionAttributeSource()
 
- 
- 
Method Details- 
setNameMapSet a name/attribute map, consisting of method names (e.g. "myMethod") andTransactionAttributeinstances.
- 
setPropertiesParse the given properties into a name/attribute map.Expects method names as keys and String attributes definitions as values, parsable into TransactionAttributeinstances via aTransactionAttributeEditor.
- 
addTransactionalMethodAdd an attribute for a transactional method.Method names can be exact matches, or of the pattern "xxx*", "*xxx", or "*xxx*" for matching multiple methods. - Parameters:
- methodName- the name of the method
- attr- attribute associated with the method
 
- 
setEmbeddedValueResolverDescription copied from interface:EmbeddedValueResolverAwareSet the StringValueResolver to use for resolving embedded definition values.- Specified by:
- setEmbeddedValueResolverin interface- EmbeddedValueResolverAware
 
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
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 (may be- null, in which case the declaring class of the method must be used)
- Returns:
- the matching transaction attribute, or nullif none found
 
- 
isMatchDetermine if the given method name matches the mapped name.The default implementation checks for "xxx*", "*xxx", and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses. - Parameters:
- methodName- the method name of the class
- mappedName- the name in the descriptor
- Returns:
- trueif the names match
- See Also:
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-