Package discord4j.rest.http
Interface WriterStrategy<R>
-
- Type Parameters:
R
- the type of object in the body
- All Known Implementing Classes:
EmptyWriterStrategy
,JacksonWriterStrategy
,MultipartWriterStrategy
public interface WriterStrategy<R>
Strategy for encoding an object of type<Req>
and writing the encoded stream of bytes to anHttpClientRequest
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canWrite(Class<?> type, String contentType)
Whether the given object type is supported by this writer.Mono<HttpClient.ResponseReceiver<?>>
write(HttpClient.RequestSender sender, R body)
Write a given object to the output message.
-
-
-
Method Detail
-
canWrite
boolean canWrite(@Nullable Class<?> type, @Nullable String contentType)
Whether the given object type is supported by this writer.- Parameters:
type
- the type of object to checkcontentType
- the content type for the write- Returns:
true
if writable,false
otherwise
-
write
Mono<HttpClient.ResponseReceiver<?>> write(HttpClient.RequestSender sender, @Nullable R body)
Write a given object to the output message.- Parameters:
sender
- the http request senderbody
- the object to write- Returns:
- indicates completion or error
-
-