org.springframework.http.codec.json

Class AbstractJackson2Decoder

    • Constructor Detail

    • Method Detail

      • canDecode

        public boolean canDecode(ResolvableType elementType,
                                 @Nullable
                                 MimeType mimeType)
        Description copied from interface: Decoder
        Whether the decoder supports the given target element type and the MIME type of the source stream.
        Specified by:
        canDecode in interface Decoder<java.lang.Object>
        Parameters:
        elementType - the target element type for the output stream
        mimeType - the mime type associated with the stream to decode (can be null if not specified)
        Returns:
        true if supported, false otherwise
      • decode

        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)
        Description copied from interface: Decoder
        Decode a DataBuffer input stream into a Flux of T.
        Specified by:
        decode in interface Decoder<java.lang.Object>
        Parameters:
        input - the DataBuffer input stream to decode
        elementType - 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 encode
        Returns:
        the output stream with decoded elements
      • decodeToMono

        public 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)
        Description copied from interface: Decoder
        Decode a DataBuffer input stream into a Mono of T.
        Specified by:
        decodeToMono in interface Decoder<java.lang.Object>
        Parameters:
        input - the DataBuffer input stream to decode
        elementType - 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 encode
        Returns:
        the output stream with the decoded element
      • getDecodeHints

        public java.util.Map<java.lang.String,java.lang.Object> getDecodeHints(ResolvableType actualType,
                                                                               ResolvableType elementType,
                                                                               ServerHttpRequest request,
                                                                               ServerHttpResponse response)
        Description copied from interface: HttpMessageDecoder
        Get decoding hints based on the server request or annotations on the target controller method parameter.
        Specified by:
        getDecodeHints in interface HttpMessageDecoder<java.lang.Object>
        Parameters:
        actualType - the actual target type to decode to, possibly a reactive wrapper and sourced from MethodParameter, i.e. providing access to method parameter annotations
        elementType - the element type within Flux/Mono that we're trying to decode to
        request - the current request
        response - the current response
        Returns:
        a Map with hints, possibly empty
      • getDecodableMimeTypes

        public java.util.List<MimeType> getDecodableMimeTypes()
        Description copied from interface: Decoder
        Return the list of MIME types this decoder supports.
        Specified by:
        getDecodableMimeTypes in interface Decoder<java.lang.Object>