Class ReactiveJaxbDecoder

  • All Implemented Interfaces:
    org.springframework.core.codec.Decoder<Object>

    @Validated
    public class ReactiveJaxbDecoder
    extends org.springframework.core.codec.AbstractDecoder<Object>
    Decode from a bytes stream containing XML elements to a stream of Objects (POJOs).

    The decoding parts are taken from Jaxb2XmlDecoder.

    Author:
    Sebastien Deleuze, Arjen Poutsma, Christian Bremer
    • Field Summary

      • Fields inherited from class org.springframework.core.codec.AbstractDecoder

        logger
    • Constructor Summary

      Constructors 
      Constructor Description
      ReactiveJaxbDecoder​(org.bremersee.xml.JaxbContextBuilder jaxbContextBuilder)
      Instantiates a new reactive jaxb decoder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canDecode​(org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType)  
      reactor.core.publisher.Flux<Object> decode​(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,​Object> hints)  
      Object decode​(org.springframework.core.io.buffer.DataBuffer dataBuffer, org.springframework.core.ResolvableType targetType, org.springframework.util.MimeType mimeType, Map<String,​Object> hints)  
      reactor.core.publisher.Mono<Object> decodeToMono​(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,​Object> hints)  
      int getMaxInMemorySize()
      Return the configured byte count limit.
      void setMaxInMemorySize​(int byteCount)
      Set the max number of bytes that can be buffered by this decoder.
      • Methods inherited from class org.springframework.core.codec.AbstractDecoder

        getDecodableMimeTypes, getLogger, setLogger
      • Methods inherited from interface org.springframework.core.codec.Decoder

        getDecodableMimeTypes
    • Constructor Detail

      • ReactiveJaxbDecoder

        public ReactiveJaxbDecoder​(org.bremersee.xml.JaxbContextBuilder jaxbContextBuilder)
        Instantiates a new reactive jaxb decoder.
        Parameters:
        jaxbContextBuilder - the jaxb context builder
    • Method Detail

      • setMaxInMemorySize

        public void setMaxInMemorySize​(int byteCount)
        Set the max number of bytes that can be buffered by this decoder. This is either the size of the entire input when decoding as a whole, or when using async parsing with Aalto XML, it is the size of one top-level XML tree. When the limit is exceeded, DataBufferLimitException is raised.

        By default this is set to 256K.

        Parameters:
        byteCount - the max number of bytes to buffer, or -1 for unlimited
      • getMaxInMemorySize

        public int getMaxInMemorySize()
        Return the configured byte count limit.
        Returns:
        the max in memory size
      • canDecode

        public boolean canDecode​(@NonNull
                                 org.springframework.core.ResolvableType elementType,
                                 @Nullable
                                 org.springframework.util.MimeType mimeType)
        Specified by:
        canDecode in interface org.springframework.core.codec.Decoder<Object>
        Overrides:
        canDecode in class org.springframework.core.codec.AbstractDecoder<Object>
      • decode

        @NonNull
        public reactor.core.publisher.Flux<Object> decode​(@NonNull
                                                          org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream,
                                                          org.springframework.core.ResolvableType elementType,
                                                          @Nullable
                                                          org.springframework.util.MimeType mimeType,
                                                          @Nullable
                                                          Map<String,​Object> hints)
      • decode

        @NonNull
        public Object decode​(org.springframework.core.io.buffer.DataBuffer dataBuffer,
                             org.springframework.core.ResolvableType targetType,
                             @Nullable
                             org.springframework.util.MimeType mimeType,
                             @Nullable
                             Map<String,​Object> hints)
                      throws org.springframework.core.codec.DecodingException
        Throws:
        org.springframework.core.codec.DecodingException
      • decodeToMono

        @NonNull
        public reactor.core.publisher.Mono<Object> decodeToMono​(@NonNull
                                                                org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input,
                                                                @NonNull
                                                                org.springframework.core.ResolvableType elementType,
                                                                @Nullable
                                                                org.springframework.util.MimeType mimeType,
                                                                @Nullable
                                                                Map<String,​Object> hints)
        Specified by:
        decodeToMono in interface org.springframework.core.codec.Decoder<Object>
        Overrides:
        decodeToMono in class org.springframework.core.codec.AbstractDecoder<Object>