MethodParameterMessageMapper/MethodArgumentMessageMapper is now ArgumentArrayMessageMapper. That name is a better match since it maps between Message and args[] (from args to message for gateway and from message to args for service-activator).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -36,7 +36,7 @@ import org.springframework.integration.annotation.Gateway;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.handler.MethodArgumentMessageMapper;
|
||||
import org.springframework.integration.handler.ArgumentArrayMessageMapper;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -225,7 +225,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint implements Factory
|
||||
|
||||
private MessagingGateway createGatewayForMethod(Method method) throws Exception {
|
||||
SimpleMessagingGateway gateway = new SimpleMessagingGateway(
|
||||
new MethodArgumentMessageMapper(method), new SimpleMessageMapper());
|
||||
new ArgumentArrayMessageMapper(method), new SimpleMessageMapper());
|
||||
if (this.getTaskScheduler() != null) {
|
||||
gateway.setTaskScheduler(this.getTaskScheduler());
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Iwein Fuld
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MethodArgumentMessageMapper implements InboundMessageMapper<Object[]>, OutboundMessageMapper<Object[]> {
|
||||
public class ArgumentArrayMessageMapper implements InboundMessageMapper<Object[]>, OutboundMessageMapper<Object[]> {
|
||||
|
||||
private final Method method;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MethodArgumentMessageMapper implements InboundMessageMapper<Object[
|
||||
private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
|
||||
|
||||
|
||||
public MethodArgumentMessageMapper(Method method) {
|
||||
public ArgumentArrayMessageMapper(Method method) {
|
||||
Assert.notNull(method, "method must not be null");
|
||||
this.method = method;
|
||||
this.parameterMetadata = this.initializeParameterMetadata();
|
||||
@@ -199,16 +199,6 @@ public class MethodArgumentMessageMapper implements InboundMessageMapper<Object[
|
||||
args[i] = message;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (mappingResult != null && mappingResult.getClass().isArray()
|
||||
&& (Object.class.isAssignableFrom(mappingResult.getClass().getComponentType()))) {
|
||||
args = (Object[]) mappingResult;
|
||||
}
|
||||
else {
|
||||
args = new Object[] { mappingResult };
|
||||
}
|
||||
*/
|
||||
|
||||
if (args.length > 1 && message != null && message.getPayload() instanceof Map) {
|
||||
int mapArgCount = 0;
|
||||
boolean resolvedMapArg = false;
|
||||
@@ -58,8 +58,8 @@ public class MessageMappingMethodInvoker implements MessageProcessor {
|
||||
|
||||
private final HandlerMethodResolver methodResolver;
|
||||
|
||||
private final ConcurrentMap<Method, MethodArgumentMessageMapper> messageMappers =
|
||||
new ConcurrentHashMap<Method, MethodArgumentMessageMapper>();
|
||||
private final ConcurrentMap<Method, ArgumentArrayMessageMapper> messageMappers =
|
||||
new ConcurrentHashMap<Method, ArgumentArrayMessageMapper>();
|
||||
|
||||
private final Map<Method, MethodInvoker> invokers = new HashMap<Method, MethodInvoker>();
|
||||
|
||||
@@ -215,11 +215,11 @@ public class MessageMappingMethodInvoker implements MessageProcessor {
|
||||
return new PayloadTypeMatchingHandlerMethodResolver(candidateMethods);
|
||||
}
|
||||
|
||||
private MethodArgumentMessageMapper resolveMessageMapper(Method method) {
|
||||
MethodArgumentMessageMapper mapper = this.messageMappers.get(method);
|
||||
private ArgumentArrayMessageMapper resolveMessageMapper(Method method) {
|
||||
ArgumentArrayMessageMapper mapper = this.messageMappers.get(method);
|
||||
if (mapper == null) {
|
||||
mapper = new MethodArgumentMessageMapper(method);
|
||||
MethodArgumentMessageMapper existingMapper = this.messageMappers.putIfAbsent(method, mapper);
|
||||
mapper = new ArgumentArrayMessageMapper(method);
|
||||
ArgumentArrayMessageMapper existingMapper = this.messageMappers.putIfAbsent(method, mapper);
|
||||
if (existingMapper != null) {
|
||||
// throw away the one just created, since one was created in the meantime
|
||||
mapper = existingMapper;
|
||||
|
||||
Reference in New Issue
Block a user