1 16 17 package org.springframework.transaction.interceptor; 18 19 import java.io.Serializable ; 20 import java.lang.reflect.Method ; 21 22 import org.springframework.util.Assert; 23 24 31 public class CompositeTransactionAttributeSource implements TransactionAttributeSource, Serializable { 32 33 private final TransactionAttributeSource[] transactionAttributeSources; 34 35 36 40 public CompositeTransactionAttributeSource(TransactionAttributeSource[] transactionAttributeSources) { 41 Assert.notNull(transactionAttributeSources, "TransactionAttributeSource array must not be null"); 42 this.transactionAttributeSources = transactionAttributeSources; 43 } 44 45 49 public final TransactionAttributeSource[] getTransactionAttributeSources() { 50 return this.transactionAttributeSources; 51 } 52 53 54 public TransactionAttribute getTransactionAttribute(Method method, Class targetClass) { 55 for (int i = 0; i < this.transactionAttributeSources.length; i++) { 56 TransactionAttributeSource tas = this.transactionAttributeSources[i]; 57 TransactionAttribute ta = tas.getTransactionAttribute(method, targetClass); 58 if (ta != null) { 59 return ta; 60 } 61 } 62 return null; 63 } 64 65 } 66 | Popular Tags |