com.octo.android.robospice.request.notifier
Class DefaultRequestListenerNotifier

java.lang.Object
  extended by com.octo.android.robospice.request.notifier.DefaultRequestListenerNotifier
All Implemented Interfaces:
RequestListenerNotifier

public class DefaultRequestListenerNotifier
extends Object
implements RequestListenerNotifier

Default implementation of RequestListenerNotifier. It will notify listeners on the ui thread.

Author:
Andrew Clark

Constructor Summary
DefaultRequestListenerNotifier()
           
 
Method Summary
<T> void
clearNotificationsForRequest(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
          Clears all pending notifications for a given request.
<T> void
notifyListenersOfRequestAdded(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
          Notify listeners that a pending request has been found.
<T> void
notifyListenersOfRequestAggregated(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
          Notify listeners that a pending request has been found.
<T> void
notifyListenersOfRequestCancellation(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
          Notify listeners of a request's cancelation.
<T> void
notifyListenersOfRequestFailure(CachedSpiceRequest<T> request, SpiceException e, Set<RequestListener<?>> listeners)
          Notify listeners of a request's failure.
<T> void
notifyListenersOfRequestNotFound(CachedSpiceRequest<T> request, Set<RequestListener<?>> listRequestListener)
          Notify listeners that no pending request is found (used by SpiceManager.addListenerIfPending(Class, Object, com.octo.android.robospice.request.listener.PendingRequestListener) .
<T> void
notifyListenersOfRequestProgress(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners, RequestProgress progress)
          Notify listeners of a request's progress.
<T> void
notifyListenersOfRequestSuccess(CachedSpiceRequest<T> request, T result, Set<RequestListener<?>> listeners)
          Notify listeners of a request's success.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRequestListenerNotifier

public DefaultRequestListenerNotifier()
Method Detail

notifyListenersOfRequestNotFound

public <T> void notifyListenersOfRequestNotFound(CachedSpiceRequest<T> request,
                                                 Set<RequestListener<?>> listRequestListener)
Description copied from interface: RequestListenerNotifier
Notify listeners that no pending request is found (used by SpiceManager.addListenerIfPending(Class, Object, com.octo.android.robospice.request.listener.PendingRequestListener) .

Specified by:
notifyListenersOfRequestNotFound in interface RequestListenerNotifier
Parameters:
request - a given request.
listRequestListener - a set of RequestListener. Only instances of PendingRequestListener will be notified of the event.

notifyListenersOfRequestAdded

public <T> void notifyListenersOfRequestAdded(CachedSpiceRequest<T> request,
                                              Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Notify listeners that a pending request has been found. This callback is invoked when a request is added into request queue, not during aggregation to a pending request.

Specified by:
notifyListenersOfRequestAdded in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener.

notifyListenersOfRequestAggregated

public <T> void notifyListenersOfRequestAggregated(CachedSpiceRequest<T> request,
                                                   Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Notify listeners that a pending request has been found. This callback is invoked when a request is aggregated to a pending request.

Specified by:
notifyListenersOfRequestAggregated in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener.

notifyListenersOfRequestProgress

public <T> void notifyListenersOfRequestProgress(CachedSpiceRequest<T> request,
                                                 Set<RequestListener<?>> listeners,
                                                 RequestProgress progress)
Description copied from interface: RequestListenerNotifier
Notify listeners of a request's progress.

Specified by:
notifyListenersOfRequestProgress in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener. Only RequestProgressListener will be notified of the event.

notifyListenersOfRequestSuccess

public <T> void notifyListenersOfRequestSuccess(CachedSpiceRequest<T> request,
                                                T result,
                                                Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Notify listeners of a request's success.

Specified by:
notifyListenersOfRequestSuccess in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener.

notifyListenersOfRequestFailure

public <T> void notifyListenersOfRequestFailure(CachedSpiceRequest<T> request,
                                                SpiceException e,
                                                Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Notify listeners of a request's failure.

Specified by:
notifyListenersOfRequestFailure in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener.

notifyListenersOfRequestCancellation

public <T> void notifyListenersOfRequestCancellation(CachedSpiceRequest<T> request,
                                                     Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Notify listeners of a request's cancelation.

Specified by:
notifyListenersOfRequestCancellation in interface RequestListenerNotifier
Parameters:
request - a given request.
listeners - a set of RequestListener.

clearNotificationsForRequest

public <T> void clearNotificationsForRequest(CachedSpiceRequest<T> request,
                                             Set<RequestListener<?>> listeners)
Description copied from interface: RequestListenerNotifier
Clears all pending notifications for a given request.

Specified by:
clearNotificationsForRequest in interface RequestListenerNotifier
Parameters:
request - the request not to notify listeners of.
listeners - the listeners that won't be notified.


Copyright © 2012-2014. All Rights Reserved.