Don't treat byte[] or collections in a special way.
This commit is contained in:
committed by
Oleg Zhurakousky
parent
0acff2b1d3
commit
b1d9890e0c
@@ -20,7 +20,6 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -29,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -699,22 +697,25 @@ public class BeanFactoryAwareFunctionRegistry
|
||||
convertedValue = this.convertValueToMessage(message, enricher, acceptedContentType);
|
||||
}
|
||||
}
|
||||
else if (value instanceof byte[]) {
|
||||
convertedValue = MessageBuilder.withPayload(value)
|
||||
.setHeader(MessageHeaders.CONTENT_TYPE, acceptedContentType).build();
|
||||
}
|
||||
else if (value instanceof Iterable || ObjectUtils.isArray(value)) {
|
||||
boolean isArray = ObjectUtils.isArray(value);
|
||||
if (isArray) {
|
||||
value = Arrays.asList((Object[]) value);
|
||||
}
|
||||
AtomicReference<List<Message>> messages = new AtomicReference<List<Message>>(new ArrayList<>());
|
||||
((Iterable) value).forEach(element ->
|
||||
messages.get()
|
||||
.add((Message) convertOutputValueIfNecessary(element, enricher, acceptedContentType
|
||||
.toString())));
|
||||
convertedValue = messages.get();
|
||||
}
|
||||
//<<<<<<< HEAD
|
||||
// else if (value instanceof byte[]) {
|
||||
// convertedValue = MessageBuilder.withPayload(value)
|
||||
// .setHeader(MessageHeaders.CONTENT_TYPE, acceptedContentType).build();
|
||||
// }
|
||||
// else if (value instanceof Iterable || ObjectUtils.isArray(value)) {
|
||||
// boolean isArray = ObjectUtils.isArray(value);
|
||||
// if (isArray) {
|
||||
// value = Arrays.asList((Object[]) value);
|
||||
// }
|
||||
// AtomicReference<List<Message>> messages = new AtomicReference<List<Message>>(new ArrayList<>());
|
||||
// ((Iterable) value).forEach(element ->
|
||||
// messages.get()
|
||||
// .add((Message) convertOutputValueIfNecessary(element, enricher, acceptedContentType
|
||||
// .toString())));
|
||||
// convertedValue = messages.get();
|
||||
// }
|
||||
//=======
|
||||
//>>>>>>> Don't treat byte[] or collections in a special way.
|
||||
else {
|
||||
convertedValue = this.convertValueToMessage(value, enricher, acceptedContentType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user