Module methanol

Interface BodyAdapter.Hints

  • Enclosing interface:
    BodyAdapter

    public static interface BodyAdapter.Hints
    A collection of hints that provide additional context to customize an adapter's encoding/decoding behavior. Typically, an adapter receives a Hints object that contains the MediaType of the intended format as advertised by the request or response. Additionally, an encoder receives a Hints objects containing the request(), and a decoder receives one that contains the responseInfo(). Some hints are optional, and adapters substitute with default values in the absence thereof (for instance, a JSON adapter may use UTF-8 in the absence of a MediaType containing a charset parameter). If a hint is required by the adapter, it throws an UnsupportedOperationException in the absence of such.
    • Method Detail

      • toMap

        java.util.Map<java.lang.Class<?>,​java.lang.Object> toMap()
        Returns an immutable map of all hints.
      • mediaType

        default java.util.Optional<MediaType> mediaType()
        Returns the MediaType hint.
      • mediaTypeOrAny

        default MediaType mediaTypeOrAny()
        Returns either the MediaType hint or MediaType.ANY if absent.
      • request

        default java.util.Optional<java.net.http.HttpRequest> request()
        Returns the HttpRequest hint.
      • responseInfo

        default java.util.Optional<java.net.http.HttpResponse.ResponseInfo> responseInfo()
        Returns the ResponseInfo hint.
      • get

        <T> java.util.Optional<T> get​(java.lang.Class<T> type)
        Returns the hint mapped to by the given type.
      • equals

        boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • empty

        static BodyAdapter.Hints empty()
        Returns a Hints object containing no hints.