Package com.contentful.java.cda
Class CDACallback<T>
- java.lang.Object
-
- com.contentful.java.cda.CDACallback<T>
-
- Type Parameters:
T- expected response type.
public abstract class CDACallback<T> extends java.lang.ObjectCommunicates responses from a server or offline requests. One and only one method will be invoked in response to a given request.
-
-
Constructor Summary
Constructors Constructor Description CDACallback()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the subscription for this callback, onFailure()/onSuccess() methods will not be called.booleanisCancelled()protected voidonFailure(java.lang.Throwable error)Invoked when a network or unexpected exception occurred during the HTTP request.protected abstract voidonSuccess(T result)Successful response.
-
-
-
Method Detail
-
onSuccess
protected abstract void onSuccess(T result)
Successful response.- Parameters:
result- the result of this operation.
-
onFailure
protected void onFailure(java.lang.Throwable error)
Invoked when a network or unexpected exception occurred during the HTTP request.- Parameters:
error- the error occurred.
-
isCancelled
public boolean isCancelled()
- Returns:
- true in case
cancel()was called.
-
cancel
public void cancel()
Cancels the subscription for this callback, onFailure()/onSuccess() methods will not be called.
-
-