T- the type which is returned in a successful http request.
public interface SphereRequest<T>
Typical workflow: A client executes
httpRequestIntent() and creates a future of an http response. When the future redeems the client uses the http response and passes it as
canDeserialize(HttpResponse). If the call results in true, the client applies
deserialize(HttpResponse) to transform the http response into T.
|Modifier and Type||Method and Description|
Checks if the response can be handled by
Takes an http response and maps it into a Java object of type T.
Provides an http request intent, this does not include the execution of it.
@Nullable T deserialize(HttpResponse httpResponse)
canDeserialize(HttpResponse)if the response can be consumed.
httpResponse- the http response of the platform
default boolean canDeserialize(HttpResponse httpResponse)
deserialize(HttpResponse). Use case 1: A http response returns 404 and the this
SphereRequestcan handle this error by returning an empty optional, an empty list or throwing a domain specific exception.
httpResponse- the http response which shall be transformed