Polishing

This commit is contained in:
Juergen Hoeller
2019-03-13 15:32:24 +01:00
parent 88049e9b5c
commit fe56aa6fa4
11 changed files with 341 additions and 321 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public class CompositeTransactionAttributeSource implements TransactionAttribute
* Create a new CompositeTransactionAttributeSource for the given sources.
* @param transactionAttributeSources the TransactionAttributeSource instances to combine
*/
public CompositeTransactionAttributeSource(TransactionAttributeSource[] transactionAttributeSources) {
public CompositeTransactionAttributeSource(TransactionAttributeSource... transactionAttributeSources) {
Assert.notNull(transactionAttributeSources, "TransactionAttributeSource array must not be null");
this.transactionAttributeSources = transactionAttributeSources;
}
@@ -56,10 +56,10 @@ public class CompositeTransactionAttributeSource implements TransactionAttribute
@Override
@Nullable
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
for (TransactionAttributeSource tas : this.transactionAttributeSources) {
TransactionAttribute ta = tas.getTransactionAttribute(method, targetClass);
if (ta != null) {
return ta;
for (TransactionAttributeSource source : this.transactionAttributeSources) {
TransactionAttribute attr = source.getTransactionAttribute(method, targetClass);
if (attr != null) {
return attr;
}
}
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.springframework.lang.Nullable;
* metadata attributes at source level (such as Java 5 annotations), or anywhere else.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 15.04.2003
* @see TransactionInterceptor#setTransactionAttributeSource
* @see TransactionProxyFactoryBean#setTransactionAttributeSource
@@ -40,8 +41,7 @@ public interface TransactionAttributeSource {
* @param method the method to introspect
* @param targetClass the target class (may be {@code null},
* in which case the declaring class of the method must be used)
* @return the TransactionAttribute the matching transaction attribute,
* or {@code null} if none found
* @return the matching transaction attribute, or {@code null} if none found
*/
@Nullable
TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass);