Class ReactiveJaxbDecoder

java.lang.Object
org.springframework.core.codec.AbstractDecoder<Object>
org.bremersee.xml.http.codec.ReactiveJaxbDecoder
All Implemented Interfaces:
org.springframework.core.codec.Decoder<Object>

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
    Instantiates a new reactive jaxb decoder.
    ReactiveJaxbDecoder(JaxbContextBuilder jaxbContextBuilder, Set<Class<?>> ignoreReadingClasses)
    Instantiates a new Reactive jaxb decoder.
  • Method Summary

    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)
     
    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
    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 class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.core.codec.Decoder

    getDecodableMimeTypes
  • Constructor Details

    • ReactiveJaxbDecoder

      public ReactiveJaxbDecoder(JaxbContextBuilder jaxbContextBuilder)
      Instantiates a new reactive jaxb decoder.
      Parameters:
      jaxbContextBuilder - the jaxb context builder
    • ReactiveJaxbDecoder

      public ReactiveJaxbDecoder(JaxbContextBuilder jaxbContextBuilder, Set<Class<?>> ignoreReadingClasses)
      Instantiates a new Reactive jaxb decoder.
      Parameters:
      jaxbContextBuilder - the jaxb context builder
      ignoreReadingClasses - the ignore reading classes
  • Method Details

    • 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>