public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport implements HttpMessageDecoder<java.lang.Object>
JSON_VIEW_HINT
Modifier | Constructor and Description |
---|---|
protected |
AbstractJackson2Decoder(ObjectMapper mapper,
MimeType... mimeTypes)
Constructor with a Jackson
ObjectMapper to use. |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecode(ResolvableType elementType,
MimeType mimeType)
Whether the decoder supports the given target element type and the MIME
type of the source stream.
|
reactor.core.publisher.Flux<java.lang.Object> |
decode(org.reactivestreams.Publisher<DataBuffer> input,
ResolvableType elementType,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Decode a
DataBuffer input stream into a Flux of T . |
reactor.core.publisher.Mono<java.lang.Object> |
decodeToMono(org.reactivestreams.Publisher<DataBuffer> input,
ResolvableType elementType,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Decode a
DataBuffer input stream into a Mono of T . |
protected <A extends java.lang.annotation.Annotation> |
getAnnotation(MethodParameter parameter,
java.lang.Class<A> annotType) |
java.util.List<MimeType> |
getDecodableMimeTypes()
Return the list of MIME types this decoder supports.
|
java.util.Map<java.lang.String,java.lang.Object> |
getDecodeHints(ResolvableType actualType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response)
Get decoding hints based on the server request or annotations on the
target controller method parameter.
|
getHints, getJavaType, getMimeTypes, getObjectMapper, getParameter, supportsMimeType
protected AbstractJackson2Decoder(ObjectMapper mapper, MimeType... mimeTypes)
ObjectMapper
to use.public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
Decoder
public reactor.core.publisher.Flux<java.lang.Object> decode(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
Decoder
DataBuffer
input stream into a Flux of T
.decode
in interface Decoder<java.lang.Object>
input
- the DataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encodepublic reactor.core.publisher.Mono<java.lang.Object> decodeToMono(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
Decoder
DataBuffer
input stream into a Mono of T
.decodeToMono
in interface Decoder<java.lang.Object>
input
- the DataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encodepublic java.util.Map<java.lang.String,java.lang.Object> getDecodeHints(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
HttpMessageDecoder
getDecodeHints
in interface HttpMessageDecoder<java.lang.Object>
actualType
- the actual target type to decode to, possibly a reactive
wrapper and sourced from MethodParameter
,
i.e. providing access to method parameter annotationselementType
- the element type within Flux/Mono
that we're
trying to decode torequest
- the current requestresponse
- the current responsepublic java.util.List<MimeType> getDecodableMimeTypes()
Decoder
getDecodableMimeTypes
in interface Decoder<java.lang.Object>
protected <A extends java.lang.annotation.Annotation> A getAnnotation(MethodParameter parameter, java.lang.Class<A> annotType)
getAnnotation
in class Jackson2CodecSupport