T - the type of object to be expected as a result. For methods that return a collection
of resources it is required to use CDAArray as the type.
Callback can be cancelled at any point using the cancel() method, that will prevent
any future calls to onSuccess(T) and onFailure(RetrofitError).public abstract class CMACallback<T> extends Object
CMAClient asynchronous methods.
Implement the onSuccess(T) method for cases where the request was successful, the result
object should be delivered as a parameter.
It is also possible, but not mandatory to override onFailure(retrofit.RetrofitError) and provide an
implementation for handling errors.| Constructor and Description |
|---|
CMACallback() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels this callback.
|
boolean |
isCancelled()
Returns true in case this callback instance was previously canceled.
|
protected void |
onFailure(retrofit.RetrofitError retrofitError)
Callback to be invoked in case the request was unsuccessful.
|
protected abstract void |
onSuccess(T result)
Callback to be invoked in case the request was successful.
|
protected abstract void onSuccess(T result)
result - result objectprotected void onFailure(retrofit.RetrofitError retrofitError)
retrofitError - RetrofitError instancepublic void cancel()
onSuccess(Object) and
onFailure(RetrofitError) methods. This action cannot be reversed.public boolean isCancelled()
Copyright © 2015 Contentful, GmbH.. All rights reserved.