1 16 17 package org.springframework.transaction.interceptor; 18 19 import java.lang.reflect.Method ; 20 import java.util.Collection ; 21 import java.util.Collections ; 22 import java.util.HashMap ; 23 24 28 public class MapTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource { 29 30 33 private HashMap attributeMap = new HashMap (); 34 35 public void register(Method m, TransactionAttribute txAtt) { 36 attributeMap.put(m, txAtt); 37 } 38 39 public void register(Class clazz, TransactionAttribute txAtt) { 40 attributeMap.put(clazz, txAtt); 41 } 42 43 46 protected Collection findAllAttributes(Class clazz) { 47 return doFindAllAttributes(clazz); 48 } 49 50 53 protected Collection findAllAttributes(Method m) { 54 return doFindAllAttributes(m); 55 } 56 57 private Collection doFindAllAttributes(Object what) { 58 Object att = attributeMap.get(what); 60 return att != null ? Collections.singleton(att) : null; 61 } 62 63 64 } 65 | Popular Tags |