Spring Framework

org.springframework.transaction.interceptor
Class MatchAlwaysTransactionAttributeSource

java.lang.Object
  extended by org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource
All Implemented Interfaces:
java.io.Serializable, TransactionAttributeSource

public class MatchAlwaysTransactionAttributeSource
extends java.lang.Object
implements TransactionAttributeSource, java.io.Serializable

Very simple implementation of TransactionAttributeSource which will always return the same TransactionAttribute for all methods fed to it. The TransactionAttribute may be specified, but will otherwise default to PROPAGATION_REQUIRED. This may be used in the cases where you want to use the same transaction attribute with all methods being handled by a transaction interceptor.

Since:
15.10.2003
Author:
Colin Sampaleanu
See Also:
TransactionProxyFactoryBean, BeanNameAutoProxyCreator, Serialized Form

Constructor Summary
MatchAlwaysTransactionAttributeSource()
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 TransactionAttribute getTransactionAttribute(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
          Return the transaction attribute for this method.
 int hashCode()
           
 void setTransactionAttribute(TransactionAttribute transactionAttribute)
          Allows a transaction attribute to be specified, using the String form, for example, "PROPAGATION_REQUIRED".
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MatchAlwaysTransactionAttributeSource

public MatchAlwaysTransactionAttributeSource()
Method Detail

setTransactionAttribute

public void setTransactionAttribute(TransactionAttribute transactionAttribute)
Allows a transaction attribute to be specified, using the String form, for example, "PROPAGATION_REQUIRED".

Parameters:
transactionAttribute - The String form of the transactionAttribute to use.
See Also:
TransactionAttributeEditor

getTransactionAttribute

public TransactionAttribute getTransactionAttribute(java.lang.reflect.Method method,
                                                    java.lang.Class<?> targetClass)
Description copied from interface: TransactionAttributeSource
Return the transaction attribute for this method. Return null if the method is non-transactional.

Specified by:
getTransactionAttribute in interface TransactionAttributeSource
Parameters:
method - method
targetClass - target class. May be null, in which case the declaring class of the method must be used.
Returns:
TransactionAttribute the matching transaction attribute, or null if none found

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Spring Framework