|
|
@ -36,7 +36,7 @@ import org.springframework.lang.UsesJava8; |
|
|
|
* @since 4.2 |
|
|
|
* @since 4.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@UsesJava8 |
|
|
|
@UsesJava8 |
|
|
|
public class StreamConverter implements ConditionalGenericConverter { |
|
|
|
class StreamConverter implements ConditionalGenericConverter { |
|
|
|
|
|
|
|
|
|
|
|
private static final TypeDescriptor STREAM_TYPE = TypeDescriptor.valueOf(Stream.class); |
|
|
|
private static final TypeDescriptor STREAM_TYPE = TypeDescriptor.valueOf(Stream.class); |
|
|
|
|
|
|
|
|
|
|
@ -107,8 +107,7 @@ public class StreamConverter implements ConditionalGenericConverter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Object convertToStream(Object source, TypeDescriptor sourceType, TypeDescriptor streamType) { |
|
|
|
private Object convertToStream(Object source, TypeDescriptor sourceType, TypeDescriptor streamType) { |
|
|
|
TypeDescriptor targetCollection = |
|
|
|
TypeDescriptor targetCollection = TypeDescriptor.collection(List.class, streamType.getElementTypeDescriptor()); |
|
|
|
TypeDescriptor.collection(List.class, streamType.getElementTypeDescriptor()); |
|
|
|
|
|
|
|
List<?> target = (List<?>) this.conversionService.convert(source, sourceType, targetCollection); |
|
|
|
List<?> target = (List<?>) this.conversionService.convert(source, sourceType, targetCollection); |
|
|
|
return target.stream(); |
|
|
|
return target.stream(); |
|
|
|
} |
|
|
|
} |
|
|
|