Module methanol

Class ForwardingDecoder

java.lang.Object
com.github.mizosoft.methanol.adapter.ForwardingBodyAdapter
com.github.mizosoft.methanol.adapter.ForwardingDecoder
All Implemented Interfaces:
BodyAdapter, BodyAdapter.Decoder

public class ForwardingDecoder extends ForwardingBodyAdapter implements BodyAdapter.Decoder
A BodyAdapter.Decoder that forwards calls to another.
  • Constructor Details

  • Method Details

    • delegate

      protected BodyAdapter delegate()
      Description copied from class: ForwardingBodyAdapter
      Returns the adapter calls are being forwarded to.
      Specified by:
      delegate in class ForwardingBodyAdapter
    • toObject

      public <T> HttpResponse.BodySubscriber<T> toObject(TypeRef<T> objectType, @Nullable MediaType mediaType)
      Description copied from interface: BodyAdapter.Decoder
      Returns a BodySubscriber that decodes the response body into an object of the given type using the format specified by the given media type. If mediaType is null, the decoder's default format parameters (e.g. charset) are used.
      Specified by:
      toObject in interface BodyAdapter.Decoder
    • toDeferredObject

      public <T> HttpResponse.BodySubscriber<Supplier<T>> toDeferredObject(TypeRef<T> objectType, @Nullable MediaType mediaType)
      Description copied from interface: BodyAdapter.Decoder
      Returns a completed BodySubscriber that lazily decodes the response body into an object of the given type using the format specified by the given media type. If mediaType is null, the decoder's default format parameters (e.g. charset) are used.

      The default implementation returns a subscriber completed with a supplier that blocks ,uninterruptedly, on the subscriber returned by BodyAdapter.Decoder.toObject(TypeRef, MediaType). Any completion exception raised while blocking is rethrown from the supplier as a CompletionException. Encoders that support reading from a blocking source should override this method to defer reading from such a source until the supplier is called.

      Specified by:
      toDeferredObject in interface BodyAdapter.Decoder