Module methanol

Interface BodyAdapter

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

public interface BodyAdapter
An object that converts 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.
    static interface 
    A collections of hints that provide additional context to customize an adapter's encoding/decoding behavior.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the format this adapter uses is compatible with the given media type.
    boolean
    supportsType(TypeRef<?> typeRef)
    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<?> typeRef)
      Returns true if this adapter supports the given type.