Interface EntityReader<T>

Type Parameters:
T - type of object to read
All Known Implementing Classes:
EntityReaderBase

public interface EntityReader<T>
Reader of entity into a specific type.
  • Method Details

    • streaming

      default boolean streaming()
      Whether this reader processes the entity incrementally without materializing it in memory. This includes copying the supplied stream to a file or another sink during the read call, as well as returning a lazy entity that consumes the stream after the read call returns. Streaming readers are not subject to max-buffered-entity-size; independently configured payload limits still apply. The default is false, including for custom readers. A reader that consumes the stream during the read call must close it before returning. A reader that returns a lazy entity must transfer responsibility for closing the stream to that entity and keep the stream usable until consumption is complete.
      Returns:
      true if the entity is processed without materializing it in memory
    • read

      T read(GenericType<T> type, InputStream stream, Headers headers)
      Read server request entity and close the stream when consumption is complete. A streaming reader may transfer stream ownership to a lazy entity as described by streaming().
      Parameters:
      type - type of entity
      stream - stream to read from
      headers - request headers
      Returns:
      correctly typed entity
    • read

      T read(GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders)
      Read client response entity and close the stream when consumption is complete. A streaming reader may transfer stream ownership to a lazy entity as described by streaming().
      Parameters:
      type - type of entity
      stream - stream to read from
      requestHeaders - request headers
      responseHeaders - response headers
      Returns:
      correctly typed entity
    • read

      default T read(GenericType<T> type, InputStream stream, Headers headers, EntityReaderContext context)
      Read a server request entity with its policy for nested entity conversions. Readers that return nested entities can retain context and use it for each nested conversion. The supplied stream already has the appropriate limits applied; the context is for nested streams. The default implementation delegates to read(GenericType, InputStream, Headers).
      Parameters:
      type - entity type
      stream - stream to read
      headers - request headers
      context - reading policy inherited by nested entities
      Returns:
      converted entity
    • read

      default T read(GenericType<T> type, InputStream stream, Headers requestHeaders, Headers responseHeaders, EntityReaderContext context)
      Read a client response entity with its policy for nested entity conversions. Readers that return nested entities can retain context and use it for each nested conversion. The supplied stream already has the appropriate limits applied; the context is for nested streams. The default implementation delegates to read(GenericType, InputStream, Headers, Headers).
      Parameters:
      type - entity type
      stream - stream to read
      requestHeaders - request headers
      responseHeaders - response headers
      context - reading policy inherited by nested entities
      Returns:
      converted entity