Class CDACallback<T>

  • Type Parameters:
    T - expected response type.

    public abstract class CDACallback<T>
    extends java.lang.Object
    Communicates 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
      void cancel()
      Cancels the subscription for this callback, onFailure()/onSuccess() methods will not be called.
      boolean isCancelled()  
      protected void onFailure​(java.lang.Throwable error)
      Invoked when a network or unexpected exception occurred during the HTTP request.
      protected abstract void onSuccess​(T result)
      Successful response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CDACallback

        public CDACallback()
    • 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.