Merge pull request #1785 from cakofony/iterator_allocation
This commit is contained in:
commit
697d2e326f
|
@ -84,7 +84,7 @@ public abstract class AbstractMethodMessageHandler<T>
|
|||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private Collection<String> destinationPrefixes = new ArrayList<>();
|
||||
private final List<String> destinationPrefixes = new ArrayList<>();
|
||||
|
||||
private final List<HandlerMethodArgumentResolver> customArgumentResolvers = new ArrayList<>(4);
|
||||
|
||||
|
@ -420,6 +420,7 @@ public abstract class AbstractMethodMessageHandler<T>
|
|||
* <p>If there are no matching prefixes, return {@code null}.
|
||||
* <p>If there are no destination prefixes, return the destination as is.
|
||||
*/
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Nullable
|
||||
protected String getLookupDestination(@Nullable String destination) {
|
||||
if (destination == null) {
|
||||
|
@ -428,7 +429,8 @@ public abstract class AbstractMethodMessageHandler<T>
|
|||
if (CollectionUtils.isEmpty(this.destinationPrefixes)) {
|
||||
return destination;
|
||||
}
|
||||
for (String prefix : this.destinationPrefixes) {
|
||||
for (int i = 0; i < this.destinationPrefixes.size(); i++) {
|
||||
String prefix = this.destinationPrefixes.get(i);
|
||||
if (destination.startsWith(prefix)) {
|
||||
return destination.substring(prefix.length());
|
||||
}
|
||||
|
|
|
@ -71,9 +71,7 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
|
|||
@Nullable List<? extends HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
|
||||
if (argumentResolvers != null) {
|
||||
for (HandlerMethodArgumentResolver resolver : argumentResolvers) {
|
||||
this.argumentResolvers.add(resolver);
|
||||
}
|
||||
this.argumentResolvers.addAll(argumentResolvers);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
|
@ -71,9 +72,7 @@ public class HandlerMethodReturnValueHandlerComposite implements AsyncHandlerMet
|
|||
@Nullable List<? extends HandlerMethodReturnValueHandler> handlers) {
|
||||
|
||||
if (handlers != null) {
|
||||
for (HandlerMethodReturnValueHandler handler : handlers) {
|
||||
this.returnValueHandlers.add(handler);
|
||||
}
|
||||
this.returnValueHandlers.addAll(handlers);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -83,9 +82,11 @@ public class HandlerMethodReturnValueHandlerComposite implements AsyncHandlerMet
|
|||
return getReturnValueHandler(returnType) != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Nullable
|
||||
private HandlerMethodReturnValueHandler getReturnValueHandler(MethodParameter returnType) {
|
||||
for (HandlerMethodReturnValueHandler handler : this.returnValueHandlers) {
|
||||
for (int i = 0; i < this.returnValueHandlers.size(); i++) {
|
||||
HandlerMethodReturnValueHandler handler = this.returnValueHandlers.get(i);
|
||||
if (handler.supportsReturnType(returnType)) {
|
||||
return handler;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue