Package discord4j.rest.http
Class FallbackReaderStrategy
java.lang.Object
discord4j.rest.http.FallbackReaderStrategy
- All Implemented Interfaces:
ReaderStrategy<Object>
Read a response as a
String
as a catch-all, unless the given response type is ErrorResponse
, in which
case it will attempt to store the response into the ErrorResponse
body
field.-
Constructor Summary
-
Method Summary
-
Constructor Details
-
FallbackReaderStrategy
public FallbackReaderStrategy()
-
-
Method Details
-
canRead
Description copied from interface:ReaderStrategy
Whether the given object type is supported by this reader.- Specified by:
canRead
in interfaceReaderStrategy<Object>
- Parameters:
type
- the type of object to checkcontentType
- the content type for the read- Returns:
true
if readable,false
otherwise
-
read
Description copied from interface:ReaderStrategy
Read from the input message and encode to a single object.- Specified by:
read
in interfaceReaderStrategy<Object>
- Parameters:
content
- the response contentsresponseType
- the type of object in the response which must have been previously checked viaReaderStrategy.canRead(Class, String)
- Returns:
- a Mono for the resolved response, according to the given response type
-