java.lang.Object
com.github.mizosoft.methanol.adapter.ForwardingBodyAdapter
com.github.mizosoft.methanol.adapter.ForwardingDecoder
- All Implemented Interfaces:
BodyAdapter
,BodyAdapter.Decoder
A
BodyAdapter.Decoder
that forwards calls to another.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.mizosoft.methanol.BodyAdapter
BodyAdapter.Decoder, BodyAdapter.Encoder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected BodyAdapter
delegate()
Returns the adapter calls are being forwarded to.<T> HttpResponse.BodySubscriber
<Supplier<T>> toDeferredObject
(TypeRef<T> objectType, @Nullable MediaType mediaType) Returns a completedBodySubscriber
that lazily decodes the response body into an object of the given type using the format specified by the given media type.<T> HttpResponse.BodySubscriber
<T> Returns aBodySubscriber
that decodes the response body into an object of the given type using the format specified by the given media type.Methods inherited from class com.github.mizosoft.methanol.adapter.ForwardingBodyAdapter
isCompatibleWith, supportsType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.mizosoft.methanol.BodyAdapter
isCompatibleWith, supportsType
-
Constructor Details
-
ForwardingDecoder
-
-
Method Details
-
delegate
Description copied from class:ForwardingBodyAdapter
Returns the adapter calls are being forwarded to.- Specified by:
delegate
in classForwardingBodyAdapter
-
toObject
public <T> HttpResponse.BodySubscriber<T> toObject(TypeRef<T> objectType, @Nullable MediaType mediaType) Description copied from interface:BodyAdapter.Decoder
Returns aBodySubscriber
that decodes the response body into an object of the given type using the format specified by the given media type. IfmediaType
isnull
, the decoder's default format parameters (e.g. charset) are used.- Specified by:
toObject
in interfaceBodyAdapter.Decoder
-
toDeferredObject
public <T> HttpResponse.BodySubscriber<Supplier<T>> toDeferredObject(TypeRef<T> objectType, @Nullable MediaType mediaType) Description copied from interface:BodyAdapter.Decoder
Returns a completedBodySubscriber
that lazily decodes the response body into an object of the given type using the format specified by the given media type. IfmediaType
isnull
, 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 aCompletionException
. 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 interfaceBodyAdapter.Decoder
-