Package discord4j.rest.http
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 aHttpClientResponseand decoding the stream of bytes to an Object of type<Res>.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanRead(Class<?> type, String contentType)Whether the given object type is supported by this reader.Mono<T>read(Mono<ByteBuf> content, Class<T> responseType)Read from the input message and encode to a single object.
-
-
-
Method Detail
-
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 checkcontentType- the content type for the read- Returns:
trueif readable,falseotherwise
-
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 contentsresponseType- the type of object in the response which must have been previously checked viacanRead(Class, String)- Returns:
- a Mono for the resolved response, according to the given response type
-
-