- All Superinterfaces:
BodyAdapter
- All Known Implementing Classes:
CharSequenceEncoder
,ForwardingEncoder
- Enclosing interface:
BodyAdapter
A
BodyAdapter
that encodes objects into request bodies.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.mizosoft.methanol.BodyAdapter
BodyAdapter.Decoder, BodyAdapter.Encoder
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional
<BodyAdapter.Encoder> getEncoder
(TypeRef<?> objectType, @Nullable MediaType mediaType) Returns anOptional
containing anEncoder
that supports the given object type and media type.static List
<BodyAdapter.Encoder> Returns an immutable list containing the installed encoders.Returns aBodyPublisher
that encodes the given object into a request body using the format specified by the given media type.Methods inherited from interface com.github.mizosoft.methanol.BodyAdapter
isCompatibleWith, supportsType
-
Method Details
-
toBody
Returns aBodyPublisher
that encodes the given object into a request body using the format specified by the given media type. IfmediaType
isnull
, the encoder's default format parameters (e.g. charset) are be used.- Throws:
UnsupportedOperationException
- if the given object's runtime type or the given media type are not supported
-
installed
Returns an immutable list containing the installed encoders. -
getEncoder
static Optional<BodyAdapter.Encoder> getEncoder(TypeRef<?> objectType, @Nullable MediaType mediaType) Returns anOptional
containing anEncoder
that supports the given object type and media type. IfmediaType
isnull
, any encoder supporting the given object type is returned
-