Module methanol
Interface AbstractBodyAdapter.BaseDecoder
-
- All Superinterfaces:
BodyAdapter,BodyAdapter.Decoder
- Enclosing class:
- AbstractBodyAdapter
public static interface AbstractBodyAdapter.BaseDecoder extends BodyAdapter.Decoder
This interface abstracts the more-capabletoObject(TypeRef, Hints)method and adds a default implementation fortoObject(TypeRef, MediaType)that forwards to the former. Additionally, this interface specifies a naive default implementation fortoDeferredObject(TypeRef, Hints), which streaming decoders should override, and defaultstoDeferredObject(TypeRef, MediaType)to forward to the former.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.mizosoft.methanol.BodyAdapter
BodyAdapter.Decoder, BodyAdapter.Encoder, BodyAdapter.Hints
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> java.net.http.HttpResponse.BodySubscriber<java.util.function.Supplier<T>>toDeferredObject(TypeRef<T> typeRef, @Nullable MediaType mediaType)Returns a completedHttpResponse.BodySubscriberthat lazily decodes the response body into an object of the given type using the format specified by the given media type.default <T> java.net.http.HttpResponse.BodySubscriber<java.util.function.Supplier<T>>toDeferredObject(TypeRef<T> typeRef, BodyAdapter.Hints hints)Returns a completedHttpResponse.BodySubscriberthat lazily decodes the response body into an object of the given type using the givenBodyAdapter.Hints.default <T> java.net.http.HttpResponse.BodySubscriber<T>toObject(TypeRef<T> typeRef, @Nullable MediaType mediaType)Returns aHttpResponse.BodySubscriberthat decodes the response body into an object of the given type using the format specified by the given media type.<T> java.net.http.HttpResponse.BodySubscriber<T>toObject(TypeRef<T> typeRef, BodyAdapter.Hints hints)Returns aHttpResponse.BodySubscriberthat decodes the response body into an object of the given type using the givenBodyAdapter.Hints.-
Methods inherited from interface com.github.mizosoft.methanol.BodyAdapter
isCompatibleWith, supportsType
-
-
-
-
Method Detail
-
toObject
default <T> java.net.http.HttpResponse.BodySubscriber<T> toObject(TypeRef<T> typeRef, @Nullable MediaType mediaType)
Returns aHttpResponse.BodySubscriberthat decodes the response body into an object of the given type using the format specified by the given media type. If the given media type isnull, the decoder's default format parameters (e.g., charset) are used.- Specified by:
toObjectin interfaceBodyAdapter.Decoder
-
toObject
<T> java.net.http.HttpResponse.BodySubscriber<T> toObject(TypeRef<T> typeRef, BodyAdapter.Hints hints)
Description copied from interface:BodyAdapter.DecoderReturns aHttpResponse.BodySubscriberthat decodes the response body into an object of the given type using the givenBodyAdapter.Hints.- Specified by:
toObjectin interfaceBodyAdapter.Decoder
-
toDeferredObject
default <T> java.net.http.HttpResponse.BodySubscriber<java.util.function.Supplier<T>> toDeferredObject(TypeRef<T> typeRef, @Nullable MediaType mediaType)
Returns a completedHttpResponse.BodySubscriberthat lazily decodes the response body into an object of the given type using the format specified by the given media type. IfmediaTypeisnull, the decoder uses its default format parameters (e.g., charset).- Specified by:
toDeferredObjectin interfaceBodyAdapter.Decoder
-
toDeferredObject
default <T> java.net.http.HttpResponse.BodySubscriber<java.util.function.Supplier<T>> toDeferredObject(TypeRef<T> typeRef, BodyAdapter.Hints hints)
Returns a completedHttpResponse.BodySubscriberthat lazily decodes the response body into an object of the given type using the givenBodyAdapter.Hints.- Specified by:
toDeferredObjectin interfaceBodyAdapter.Decoder
-
-