Class CMACallback<T>

  • Type Parameters:
    T - the type of object to be expected as a result. For methods that return a collection of resources it is required to use CMAArray 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(RuntimeException).


    public abstract class CMACallback<T>
    extends java.lang.Object
    Callback to be used with any of the 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(java.lang.RuntimeException) and provide an implementation for handling errors.

    • Constructor Summary

      Constructors 
      Constructor Description
      CMACallback()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      Cancels this callback.
      boolean isCancelled()  
      protected void onFailure​(java.lang.RuntimeException exception)
      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.
      • Methods inherited from class java.lang.Object

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

      • CMACallback

        public CMACallback()
    • Method Detail

      • onSuccess

        protected abstract void onSuccess​(T result)
        Callback to be invoked in case the request was successful.
        Parameters:
        result - result object
      • onFailure

        protected void onFailure​(java.lang.RuntimeException exception)
        Callback to be invoked in case the request was unsuccessful.
        Parameters:
        exception - RuntimeException instance
      • isCancelled

        public boolean isCancelled()
        Returns:
        true in case this callback instance was previously canceled.