Interface ReaderStrategy<T>

Type Parameters:
T - the type of object in the read response
All Known Implementing Classes:
EmptyReaderStrategy, FallbackReaderStrategy, JacksonReaderStrategy

public interface ReaderStrategy<T>
Strategy for reading from a HttpClientResponse and decoding the stream of bytes to an Object of type <Res>.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canRead(Class<?> type, String contentType)
    Whether the given object type is supported by this reader.
    read(Mono<ByteBuf> content, Class<T> responseType)
    Read from the input message and encode to a single object.
  • Method Details

    • canRead

      boolean canRead(@Nullable Class<?> type, @Nullable String contentType)
      Whether the given object type is supported by this reader.
      Parameters:
      type - the type of object to check
      contentType - the content type for the read
      Returns:
      true if readable, false otherwise
    • read

      Mono<T> read(Mono<ByteBuf> content, Class<T> responseType)
      Read from the input message and encode to a single object.
      Parameters:
      content - the response contents
      responseType - the type of object in the response which must have been previously checked via canRead(Class, String)
      Returns:
      a Mono for the resolved response, according to the given response type