Support decoding Mono in Jaxb2XmlDecoder

Issue: SPR-16759
This commit is contained in:
Sebastien Deleuze
2018-05-02 11:57:40 +02:00
parent 22edab852d
commit af0cb53742
3 changed files with 16 additions and 2 deletions

View File

@@ -107,6 +107,12 @@ public class Jaxb2XmlDecoder extends AbstractDecoder<Object> {
return splitEvents.map(events -> unmarshal(events, outputClass));
}
@Override
public Mono<Object> decodeToMono(Publisher<DataBuffer> inputStream, ResolvableType elementType,
@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
return decode(inputStream, elementType, mimeType, hints).singleOrEmpty();
}
private Object unmarshal(List<XMLEvent> events, Class<?> outputClass) {
try {
Unmarshaller unmarshaller = this.jaxbContexts.createUnmarshaller(outputClass);