|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.interceptor.MethodMapTransactionAttributeSource
public class MethodMapTransactionAttributeSource
Simple TransactionAttributeSource
implementation that
allows attributes to be stored per method in a Map
.
isMatch(java.lang.String, java.lang.String)
,
NameMatchTransactionAttributeSource
Field Summary | |
---|---|
protected Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
MethodMapTransactionAttributeSource()
|
Method Summary | |
---|---|
void |
addTransactionalMethod(Class clazz,
String mappedName,
TransactionAttribute attr)
Add an attribute for a transactional method. |
void |
addTransactionalMethod(Method method,
TransactionAttribute attr)
Add an attribute for a transactional method. |
void |
addTransactionalMethod(String name,
TransactionAttribute attr)
Add an attribute for a transactional method. |
void |
afterPropertiesSet()
Eagerly initializes the specified "methodMap" , if any. |
boolean |
equals(Object other)
|
TransactionAttribute |
getTransactionAttribute(Method method,
Class targetClass)
Return the transaction attribute for this method. |
int |
hashCode()
|
protected void |
initMethodMap(Map methodMap)
Initialize the specified "methodMap" , if any. |
protected boolean |
isMatch(String methodName,
String mappedName)
Return if the given method name matches the mapped name. |
void |
setBeanClassLoader(ClassLoader beanClassLoader)
Callback that supplies the bean class loader to
a bean instance. |
void |
setMethodMap(Map methodMap)
Set a name/attribute map, consisting of "FQCN.method" method names (e.g. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
public MethodMapTransactionAttributeSource()
Method Detail |
---|
public void setMethodMap(Map methodMap)
TransactionAttribute
instances (or Strings to be converted
to TransactionAttribute
instances).
Intended for configuration via setter injection, typically within
a Spring bean factory. Relies on afterPropertiesSet()
being called afterwards.
methodMap
- said Map
from method name to attribute valueTransactionAttribute
,
TransactionAttributeEditor
public void setBeanClassLoader(ClassLoader beanClassLoader)
BeanClassLoaderAware
class loader
to
a bean instance.
Invoked after the population of normal bean properties but
before an initialization callback such as
InitializingBean's
InitializingBean.afterPropertiesSet()
method or a custom init-method.
setBeanClassLoader
in interface BeanClassLoaderAware
beanClassLoader
- the owning class loader; may be null
in
which case a default ClassLoader
must be used, for example
the ClassLoader
obtained via
ClassUtils.getDefaultClassLoader()
public void afterPropertiesSet()
"methodMap"
, if any.
afterPropertiesSet
in interface InitializingBean
initMethodMap(java.util.Map)
protected void initMethodMap(Map methodMap)
"methodMap"
, if any.
methodMap
- Map from method names to TransactionAttribute
instances
(or Strings to be converted to TransactionAttribute
instances)setMethodMap(java.util.Map)
public void addTransactionalMethod(String name, TransactionAttribute attr)
Method names can end or start with "*" for matching multiple methods.
name
- class and method name, separated by a dotattr
- attribute associated with the method
IllegalArgumentException
- in case of an invalid namepublic void addTransactionalMethod(Class clazz, String mappedName, TransactionAttribute attr)
clazz
- target interface or classmappedName
- mapped method nameattr
- attribute associated with the methodpublic void addTransactionalMethod(Method method, TransactionAttribute attr)
method
- the methodattr
- attribute associated with the methodprotected boolean isMatch(String methodName, String mappedName)
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality.
methodName
- the method name of the classmappedName
- the name in the descriptor
PatternMatchUtils.simpleMatch(String, String)
public TransactionAttribute getTransactionAttribute(Method method, Class targetClass)
TransactionAttributeSource
getTransactionAttribute
in interface TransactionAttributeSource
method
- methodtargetClass
- target class. May be null
, in which
case the declaring class of the method must be used.
null
if none foundpublic boolean equals(Object other)
public int hashCode()
public String toString()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |