T
- Successful response body type.public interface ICall<T>
extends java.lang.Cloneable
clone()
to make multiple
calls with the same parameters to the same webserver; this may be used to implement polling or
to retry a failed call.
Calls may be executed synchronously with execute()
, or asynchronously with enqueue(com.iotize.android.device.device.api.service.builder.ICallback<T>)
. In either case the call can be canceled at any time with cancel()
. A call that
is busy writing its request or reading its response may receive a IOException
; this is
working as designed.
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this call.
|
ICall<T> |
clone()
Create a new, identical call to this one which can be enqueued or executed even if this call
has already been.
|
void |
enqueue(ICallback<T> callback)
Asynchronously send the request and notify
callback of its response or if an error
occurred talking to the server, creating the request, or processing the response. |
<any> |
execute()
Synchronously send the request and return its response.
|
T |
get()
Helper function that calls execute() and body()
|
boolean |
isCanceled()
True if
cancel() was called. |
boolean |
isExecuted()
Returns true if this call has been either executed or enqueue(ICallback).
|
Command |
request()
The original request.
|
<any> execute() throws java.lang.Exception
java.io.IOException
- if a problem occurred talking to the server.java.lang.RuntimeException
- (and subclasses) if an unexpected error occurs creating the request
or decoding the response.java.lang.Exception
void enqueue(ICallback<T> callback)
callback
of its response or if an error
occurred talking to the server, creating the request, or processing the response.callback
- the callbackboolean isExecuted()
void cancel()
boolean isCanceled()
cancel()
was called.ICall<T> clone()
Command request()
T get() throws java.lang.Exception
java.lang.Exception
- any exception that could occurred during request or decoding the request