Interface Encoding


public interface Encoding
An encoding provides support for a
Content-Type
corresponding with the conjure wire format. Encodings provide a content type string as well as factories for typed Encoding.Serializer and Encoding.Deserializer objects.

This interface is considered internal API and may change without a major version rev. Custom implementations are not recommended, but may be implemented to test custom encodings without a fork of the runtime.

  • Method Details

    • serializer

      <T> Encoding.Serializer<T> serializer(com.palantir.dialogue.TypeMarker<T> type)
      Creates a new Encoding.Serializer for the requested type. It is recommended to reuse instances over requesting new ones for each request.
    • deserializer

      <T> Encoding.Deserializer<T> deserializer(com.palantir.dialogue.TypeMarker<T> type)
      Creates a new Encoding.Deserializer for the requested type. It is recommended to reuse instances over requesting new ones for each request.
    • getContentType

      String getContentType()
      Returns the value used in request
      Content-Type
      headers.
    • supportsContentType

      boolean supportsContentType(String contentType)
      Checks if a
      Content-Type
      or
      Accept
      value is supported by this encoding. This is not an exact match on getContentType() because values may contain additional metadata, for example
      Content-Type: application/json; charset=utf-8
      may be supported by an Encoding which returns
      application/json
      from getContentType().