Module methanol

Interface BodyAdapter

All Known Subinterfaces:
BodyAdapter.Decoder, BodyAdapter.Encoder
All Known Implementing Classes:
AbstractBodyAdapter, CharSequenceEncoder, ForwardingBodyAdapter, ForwardingDecoder, ForwardingEncoder, StringDecoder

public interface BodyAdapter
An object that converts high objects to or from request or response bodies respectively, using a defined format. The two specialized subtypes are BodyAdapter.Encoder and BodyAdapter.Decoder.

A BodyAdapter communicates the format it uses and the set of types it supports through isCompatibleWith(MediaType) and supportsType(TypeRef) respectively. For example, a BodyAdapter that uses JSON is compatible with any application/json media type, and supports any object type supported by the underlying serializer/deserializer.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A BodyAdapter that decodes response bodies into objects.
    static interface 
    A BodyAdapter that encodes objects into request bodies.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the format this adapter uses is compatible with the given media type.
    boolean
    Returns true if this adapter supports the given type.
  • Method Details

    • isCompatibleWith

      boolean isCompatibleWith(MediaType mediaType)
      Returns true if the format this adapter uses is compatible with the given media type.
    • supportsType

      boolean supportsType(TypeRef<?> type)
      Returns true if this adapter supports the given type.