Browse Source

Merge pull request #1459 from diguage:lambda-map

* pr/1459:
  Polish "Refactor iterator of Map with Java8's Map.forEach"
  Refactor iterator of Map with Java8's Map.forEach
pull/1458/merge
Stephane Nicoll 8 years ago
parent
commit
5e4e3fbe8b
  1. 10
      spring-context-indexer/src/main/java/org/springframework/context/index/PropertiesMarshaller.java
  2. 2
      spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java
  3. 13
      spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSource.java
  4. 8
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java
  5. 9
      spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java
  6. 6
      spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java
  7. 16
      spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java
  8. 4
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java
  9. 17
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java
  10. 16
      spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java
  11. 7
      spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java
  12. 8
      spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java
  13. 22
      spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java
  14. 24
      spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java
  15. 20
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java
  16. 15
      spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java
  17. 4
      spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java
  18. 6
      spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java

10
spring-context-indexer/src/main/java/org/springframework/context/index/PropertiesMarshaller.java

@ -21,7 +21,6 @@ import java.io.InputStream; @@ -21,7 +21,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@ -43,11 +42,10 @@ abstract class PropertiesMarshaller { @@ -43,11 +42,10 @@ abstract class PropertiesMarshaller {
CandidateComponentsMetadata result = new CandidateComponentsMetadata();
Properties props = new Properties();
props.load(in);
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String type = (String) entry.getKey();
Set<String> candidates = new HashSet<>(Arrays.asList(((String) entry.getValue()).split(",")));
result.add(new ItemMetadata(type, candidates));
}
props.forEach((type, value) -> {
Set<String> candidates = new HashSet<>(Arrays.asList(((String) value).split(",")));
result.add(new ItemMetadata((String) type, candidates));
});
return result;
}

2
spring-context-support/src/main/java/org/springframework/cache/caffeine/CaffeineCacheManager.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.

13
spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -131,13 +131,12 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource { @@ -131,13 +131,12 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
*/
public MapSqlParameterSource addValues(@Nullable Map<String, ?> values) {
if (values != null) {
for (Map.Entry<String, ?> entry : values.entrySet()) {
this.values.put(entry.getKey(), entry.getValue());
if (entry.getValue() instanceof SqlParameterValue) {
SqlParameterValue value = (SqlParameterValue) entry.getValue();
registerSqlType(entry.getKey(), value.getSqlType());
values.forEach((key, value) -> {
this.values.put(key, value);
if (value instanceof SqlParameterValue) {
registerSqlType(key, ((SqlParameterValue) value).getSqlType());
}
}
});
}
return this;
}

8
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java

@ -114,11 +114,11 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple @@ -114,11 +114,11 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple
throw new IllegalArgumentException("Property 'targetDataSources' is required");
}
this.resolvedDataSources = new HashMap<>(this.targetDataSources.size());
for (Map.Entry<Object, Object> entry : this.targetDataSources.entrySet()) {
Object lookupKey = resolveSpecifiedLookupKey(entry.getKey());
DataSource dataSource = resolveSpecifiedDataSource(entry.getValue());
this.targetDataSources.forEach((key, value) -> {
Object lookupKey = resolveSpecifiedLookupKey(key);
DataSource dataSource = resolveSpecifiedDataSource(value);
this.resolvedDataSources.put(lookupKey, dataSource);
}
});
if (this.defaultTargetDataSource != null) {
this.resolvedDefaultDataSource = resolveSpecifiedDataSource(this.defaultTargetDataSource);
}

9
spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java

@ -225,12 +225,9 @@ public class JmsListenerAnnotationBeanPostProcessor @@ -225,12 +225,9 @@ public class JmsListenerAnnotationBeanPostProcessor
}
else {
// Non-empty set of methods
for (Map.Entry<Method, Set<JmsListener>> entry : annotatedMethods.entrySet()) {
Method method = entry.getKey();
for (JmsListener listener : entry.getValue()) {
processJmsListener(listener, method, bean);
}
}
annotatedMethods.forEach((method, listeners) ->
listeners.forEach(listener ->
processJmsListener(listener, method, bean)));
if (logger.isDebugEnabled()) {
logger.debug(annotatedMethods.size() + " @JmsListener methods processed on bean '" + beanName +
"': " + annotatedMethods);

6
spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java

@ -158,12 +158,10 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B @@ -158,12 +158,10 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
*/
public void setTypeIdMappings(Map<String, Class<?>> typeIdMappings) {
this.idClassMappings = new HashMap<>();
for (Map.Entry<String, Class<?>> entry : typeIdMappings.entrySet()) {
String id = entry.getKey();
Class<?> clazz = entry.getValue();
typeIdMappings.forEach((id, clazz) -> {
this.idClassMappings.put(id, clazz);
this.classIdMappings.put(clazz, id);
}
});
}
@Override

16
spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java

@ -149,11 +149,11 @@ public class MessageHeaders implements Map<String, Object>, Serializable { @@ -149,11 +149,11 @@ public class MessageHeaders implements Map<String, Object>, Serializable {
*/
private MessageHeaders(MessageHeaders original, Set<String> keysToIgnore) {
this.headers = new HashMap<>(original.headers.size() - keysToIgnore.size());
for (Map.Entry<String, Object> entry : original.headers.entrySet()) {
if (!keysToIgnore.contains(entry.getKey())) {
this.headers.put(entry.getKey(), entry.getValue());
original.headers.forEach((key, value) -> {
if (!keysToIgnore.contains(key)) {
this.headers.put(key, value);
}
}
});
}
@ -276,11 +276,11 @@ public class MessageHeaders implements Map<String, Object>, Serializable { @@ -276,11 +276,11 @@ public class MessageHeaders implements Map<String, Object>, Serializable {
private void writeObject(ObjectOutputStream out) throws IOException {
Set<String> keysToIgnore = new HashSet<>();
for (Map.Entry<String, Object> entry : this.headers.entrySet()) {
if (!(entry.getValue() instanceof Serializable)) {
keysToIgnore.add(entry.getKey());
this.headers.forEach((key, value) -> {
if (!(value instanceof Serializable)) {
keysToIgnore.add(key);
}
}
});
if (keysToIgnore.isEmpty()) {
// All entries are serializable -> serialize the regular MessageHeaders instance

4
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java

@ -288,9 +288,7 @@ public abstract class AbstractMethodMessageHandler<T> @@ -288,9 +288,7 @@ public abstract class AbstractMethodMessageHandler<T>
if (logger.isDebugEnabled()) {
logger.debug(methods.size() + " message handler methods found on " + userType + ": " + methods);
}
for (Map.Entry<Method, T> entry : methods.entrySet()) {
registerHandlerMethod(handler, entry.getKey(), entry.getValue());
}
methods.forEach((key, value) -> registerHandlerMethod(handler, key, value));
}
}

17
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java

@ -113,10 +113,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable @@ -113,10 +113,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
Assert.notNull(headers, "'headers' must not be null");
if (readOnly) {
Map<String, List<String>> map = new LinkedMultiValueMap<>(headers.size());
for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = Collections.unmodifiableList(entry.getValue());
map.put(entry.getKey(), values);
}
headers.forEach((key, value) -> map.put(key, Collections.unmodifiableList(value)));
this.headers = Collections.unmodifiableMap(map);
}
else {
@ -424,9 +421,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable @@ -424,9 +421,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
@Override
public void addAll(MultiValueMap<String, String> values) {
for (Entry<String, List<String>> entry : values.entrySet()) {
addAll(entry.getKey(), entry.getValue());
}
values.forEach(this::addAll);
}
/**
@ -446,17 +441,13 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable @@ -446,17 +441,13 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
@Override
public void setAll(Map<String, String> values) {
for (Entry<String, String> entry : values.entrySet()) {
set(entry.getKey(), entry.getValue());
}
values.forEach(this::set);
}
@Override
public Map<String, String> toSingleValueMap() {
LinkedHashMap<String, String> singleValueMap = new LinkedHashMap<>(this.headers.size());
for (Entry<String, List<String>> entry : headers.entrySet()) {
singleValueMap.put(entry.getKey(), entry.getValue().get(0));
}
headers.forEach((key, value) -> singleValueMap.put(key, value.get(0)));
return singleValueMap;
}

16
spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java

@ -387,11 +387,11 @@ public class MessageHeaderAccessor { @@ -387,11 +387,11 @@ public class MessageHeaderAccessor {
*/
public void copyHeaders(@Nullable Map<String, ?> headersToCopy) {
if (headersToCopy != null) {
for (Map.Entry<String, ?> entry : headersToCopy.entrySet()) {
if (!isReadOnly(entry.getKey())) {
setHeader(entry.getKey(), entry.getValue());
headersToCopy.forEach((key, value) -> {
if (!isReadOnly(key)) {
setHeader(key, value);
}
}
});
}
}
@ -401,11 +401,11 @@ public class MessageHeaderAccessor { @@ -401,11 +401,11 @@ public class MessageHeaderAccessor {
*/
public void copyHeadersIfAbsent(@Nullable Map<String, ?> headersToCopy) {
if (headersToCopy != null) {
for (Map.Entry<String, ?> entry : headersToCopy.entrySet()) {
if (!isReadOnly(entry.getKey())) {
setHeaderIfAbsent(entry.getKey(), entry.getValue());
headersToCopy.forEach((key, value) -> {
if (!isReadOnly(key)) {
setHeaderIfAbsent(key, value);
}
}
});
}
}

7
spring-messaging/src/main/java/org/springframework/messaging/support/NativeMessageHeaderAccessor.java

@ -197,11 +197,8 @@ public class NativeMessageHeaderAccessor extends MessageHeaderAccessor { @@ -197,11 +197,8 @@ public class NativeMessageHeaderAccessor extends MessageHeaderAccessor {
if (headers == null) {
return;
}
for (Map.Entry<String, List<String>> headerEntry : headers.entrySet()) {
for (String value : headerEntry.getValue()) {
addNativeHeader(headerEntry.getKey(), value);
}
}
headers.forEach((key, values) ->
values.forEach(value -> addNativeHeader(key, value)));
}
@Nullable

8
spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java

@ -325,11 +325,11 @@ public abstract class AbstractEntityManagerFactoryBean implements @@ -325,11 +325,11 @@ public abstract class AbstractEntityManagerFactoryBean implements
}
Map<String, ?> vendorPropertyMap = this.jpaVendorAdapter.getJpaPropertyMap();
if (vendorPropertyMap != null) {
for (Map.Entry<String, ?> entry : vendorPropertyMap.entrySet()) {
if (!this.jpaPropertyMap.containsKey(entry.getKey())) {
this.jpaPropertyMap.put(entry.getKey(), entry.getValue());
vendorPropertyMap.forEach((key, value) -> {
if (!this.jpaPropertyMap.containsKey(key)) {
this.jpaPropertyMap.put(key, value);
}
}
});
}
if (this.entityManagerFactoryInterface == null) {
this.entityManagerFactoryInterface = this.jpaVendorAdapter.getEntityManagerFactoryInterface();

22
spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@ -474,9 +474,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing @@ -474,9 +474,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
context.addPackages(targetPackages);
}
if (this.castorProperties != null) {
for (Map.Entry<String, String> property : this.castorProperties.entrySet()) {
context.setProperty(property.getKey(), property.getValue());
}
this.castorProperties.forEach(context::setProperty);
}
return context;
}
@ -563,19 +561,13 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing @@ -563,19 +561,13 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
marshaller.setSchemaLocation(this.schemaLocation);
marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
if (this.doctypes != null) {
for (Map.Entry<String, String> doctype : this.doctypes.entrySet()) {
marshaller.setDoctype(doctype.getKey(), doctype.getValue());
}
this.doctypes.forEach(marshaller::setDoctype);
}
if (this.processingInstructions != null) {
for (Map.Entry<String, String> processingInstruction : this.processingInstructions.entrySet()) {
marshaller.addProcessingInstruction(processingInstruction.getKey(), processingInstruction.getValue());
}
this.processingInstructions.forEach(marshaller::addProcessingInstruction);
}
if (this.namespaceMappings != null) {
for (Map.Entry<String, String> entry : this.namespaceMappings.entrySet()) {
marshaller.setNamespaceMapping(entry.getKey(), entry.getValue());
}
this.namespaceMappings.forEach(marshaller::setNamespaceMapping);
}
}
@ -666,9 +658,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing @@ -666,9 +658,7 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing
unmarshaller.setReuseObjects(this.reuseObjects);
unmarshaller.setClearCollections(this.clearCollections);
if (this.namespaceToPackageMapping != null) {
for (Map.Entry<String, String> mapping : this.namespaceToPackageMapping.entrySet()) {
unmarshaller.addNamespaceToPackageMapping(mapping.getKey(), mapping.getValue());
}
this.namespaceToPackageMapping.forEach(unmarshaller::addNamespaceToPackageMapping);
}
if (this.entityResolver != null) {
unmarshaller.setEntityResolver(this.entityResolver);

24
spring-oxm/src/main/java/org/springframework/oxm/xstream/XStreamMarshaller.java

@ -469,15 +469,11 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo @@ -469,15 +469,11 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
try {
if (this.aliases != null) {
Map<String, Class<?>> classMap = toClassMap(this.aliases);
for (Map.Entry<String, Class<?>> entry : classMap.entrySet()) {
xstream.alias(entry.getKey(), entry.getValue());
}
classMap.forEach(xstream::alias);
}
if (this.aliasesByType != null) {
Map<String, Class<?>> classMap = toClassMap(this.aliasesByType);
for (Map.Entry<String, Class<?>> entry : classMap.entrySet()) {
xstream.aliasType(entry.getKey(), entry.getValue());
}
classMap.forEach(xstream::aliasType);
}
if (this.fieldAliases != null) {
for (Map.Entry<String, String> entry : this.fieldAliases.entrySet()) {
@ -543,20 +539,20 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo @@ -543,20 +539,20 @@ public class XStreamMarshaller extends AbstractMarshaller implements BeanClassLo
}
if (this.implicitCollections != null) {
for (Map.Entry<Class<?>, String> entry : this.implicitCollections.entrySet()) {
String[] collectionFields = StringUtils.commaDelimitedListToStringArray(entry.getValue());
this.implicitCollections.forEach((key, fields) -> {
String[] collectionFields = StringUtils.commaDelimitedListToStringArray(fields);
for (String collectionField : collectionFields) {
xstream.addImplicitCollection(entry.getKey(), collectionField);
xstream.addImplicitCollection(key, collectionField);
}
}
});
}
if (this.omittedFields != null) {
for (Map.Entry<Class<?>, String> entry : this.omittedFields.entrySet()) {
String[] fields = StringUtils.commaDelimitedListToStringArray(entry.getValue());
this.omittedFields.forEach((key, value) -> {
String[] fields = StringUtils.commaDelimitedListToStringArray(value);
for (String field : fields) {
xstream.omitField(entry.getKey(), field);
xstream.omitField(key, field);
}
}
});
}
if (this.annotatedClasses != null) {

20
spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java

@ -26,7 +26,6 @@ import java.util.Enumeration; @@ -26,7 +26,6 @@ import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;
@ -182,11 +181,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -182,11 +181,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
// parameter
Map<String, String[]> parentParams = parentRequest.getParameterMap();
for (Map.Entry<String, String[]> parentParam : parentParams.entrySet()) {
String paramName = parentParam.getKey();
String[] paramValues = parentParam.getValue();
request.addParameter(paramName, paramValues);
}
parentParams.forEach(request::addParameter);
// cookie
Cookie[] parentCookies = parentRequest.getCookies();
@ -314,9 +309,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -314,9 +309,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
}
private void headers(MockHttpServletRequest request) {
for (Entry<String, String> header : this.webRequest.getAdditionalHeaders().entrySet()) {
request.addHeader(header.getKey(), header.getValue());
}
this.webRequest.getAdditionalHeaders().forEach(request::addHeader);
}
private MockHttpSession httpSession(MockHttpServletRequest request, final String sessionid) {
@ -359,14 +352,13 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -359,14 +352,13 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
}
private void params(MockHttpServletRequest request, UriComponents uriComponents) {
for (Entry<String, List<String>> entry : uriComponents.getQueryParams().entrySet()) {
String name = entry.getKey();
uriComponents.getQueryParams().forEach((name, values) -> {
String urlDecodedName = urlDecode(name);
for (String value : entry.getValue()) {
values.forEach(value -> {
value = (value != null ? urlDecode(value) : "");
request.addParameter(urlDecodedName, value);
}
}
});
});
for (NameValuePair param : this.webRequest.getRequestParameters()) {
request.addParameter(param.getName(), param.getValue());
}

15
spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java

@ -28,7 +28,6 @@ import java.util.LinkedHashMap; @@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie;
@ -310,9 +309,7 @@ public class MockHttpServletRequestBuilder @@ -310,9 +309,7 @@ public class MockHttpServletRequestBuilder
* @param httpHeaders the headers and values to add
*/
public MockHttpServletRequestBuilder headers(HttpHeaders httpHeaders) {
for (Map.Entry<String, List<String>> entry : httpHeaders.entrySet()) {
this.headers.addAll(entry.getKey(), entry.getValue());
}
httpHeaders.forEach(this.headers::addAll);
return this;
}
@ -697,12 +694,10 @@ public class MockHttpServletRequestBuilder @@ -697,12 +694,10 @@ public class MockHttpServletRequestBuilder
}
private void addRequestParams(MockHttpServletRequest request, MultiValueMap<String, String> map) {
for (Entry<String, List<String>> entry : map.entrySet()) {
for (String value : entry.getValue()) {
value = (value != null ? UriUtils.decode(value, StandardCharsets.UTF_8) : null);
request.addParameter(UriUtils.decode(entry.getKey(), StandardCharsets.UTF_8), value);
}
}
map.forEach((key, values) -> values.forEach(value -> {
value = (value != null ? UriUtils.decode(value, StandardCharsets.UTF_8) : null);
request.addParameter(UriUtils.decode(key, StandardCharsets.UTF_8), value);
}));
}
private MultiValueMap<String, String> parseFormData(final MediaType mediaType) {

4
spring-tx/src/main/java/org/springframework/transaction/interceptor/MethodMapTransactionAttributeSource.java

@ -106,9 +106,7 @@ public class MethodMapTransactionAttributeSource @@ -106,9 +106,7 @@ public class MethodMapTransactionAttributeSource
*/
protected void initMethodMap(@Nullable Map<String, TransactionAttribute> methodMap) {
if (methodMap != null) {
for (Map.Entry<String, TransactionAttribute> entry : methodMap.entrySet()) {
addTransactionalMethod(entry.getKey(), entry.getValue());
}
methodMap.forEach(this::addTransactionalMethod);
}
}

6
spring-tx/src/main/java/org/springframework/transaction/interceptor/NameMatchTransactionAttributeSource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -61,9 +61,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute @@ -61,9 +61,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
* @see TransactionAttributeEditor
*/
public void setNameMap(Map<String, TransactionAttribute> nameMap) {
for (Map.Entry<String, TransactionAttribute> entry : nameMap.entrySet()) {
addTransactionalMethod(entry.getKey(), entry.getValue());
}
nameMap.forEach(this::addTransactionalMethod);
}
/**

Loading…
Cancel
Save