public interface Performer<T> extends QBCancelable
Performer may be executed synchronously with perform()
, or asynchronously with performAsync(com.quickblox.core.QBEntityCallback<T>)
. In either case the request can be canceled at any time with QBCancelable.cancel()
.
Performerperformer = QBAuth.createSession(); //asynchronous request performer.performAsync(new QBEntityCallback () { @Override public void onSuccess(QBSession result, Bundle params) { } @Override public void onError(QBResponseException responseException) { } }); //synchronous request try { QBSession perform = performer.perform(); } catch (QBResponseException e){ }
Modifier and Type | Method and Description |
---|---|
<R> R |
convertTo(PerformProcessor<?> performProcessor)
Converts(adapts) Performer using PerformProcessor to any other model.
|
boolean |
isCanceled()
True if
QBCancelable.cancel() was called. |
T |
perform()
Executes request synchronously and return its response.
|
void |
performAsync(QBEntityCallback<T> callback)
Executes request asynchronously and notify
callback of its response or if an error
occurred talking to the server, creating the request, or processing the response. |
cancel
void performAsync(QBEntityCallback<T> callback)
callback
of its response or if an error
occurred talking to the server, creating the request, or processing the response.T perform() throws QBResponseException
QBResponseException
- if a problem occurred talking to the server or
if an unexpected error occurs decoding the response.<R> R convertTo(PerformProcessor<?> performProcessor)
Converting logic is defined by PerformProcessor
R
boolean isCanceled()
QBCancelable.cancel()
was called.