public final class CallbackDispatcher<T>
- Object
- CallbackDispatcher
ImplementsRunnable
A utility class for calling
Callbacks on the EDT.Methods
public static <T> void dispatchSuccess(SuccessCallback<T> success, T arg) | Calls the given callback’s Callback#onSucess(java.lang.Object) method, passing the supplied arg as a parameter. |
public static void dispatchError(FailureCallback failure, Throwable error) | Calls the given callback’s java.lang.Throwable, int, java.lang.String) method, passing the supplied error as a parameter. |
public void run() | When an object implementing interface Runnable is used to create a thread, starting the thread causes the object’s run method to be called in that separately executing thread. |
Inherited methods
Method details
dispatchSuccess
public static <T> void dispatchSuccess(SuccessCallback<T> success, T arg)Calls the given callback’s
Callback#onSucess(java.lang.Object) method, passing the supplied arg as
a parameter. This method guarantees that onSuccess() will be called on the EDT. If it is already running
on the EDT, it will just call it directly. Otherwise it will wrap it in Display#callSerially(java.lang.Runnable).Parameters
successSuccessCallback<T>- The success callback to be called.
argT- The argument to pass to the success callback.
dispatchError
public static void dispatchError(FailureCallback failure, Throwable error)Calls the given callback’s
java.lang.Throwable, int, java.lang.String) method, passing the supplied error as
a parameter. This method guarantees that onError() will be called on the EDT. If it is already running
on the EDT, it will just call it directly. Otherwise it will wrap it in Display#callSerially(java.lang.Runnable).Parameters
failureFailureCallback- The failure callback to be called.
errorThrowable- The error to pass to the callback
run
public void run()When an object implementing interface Runnable is used to create a thread, starting the thread causes the object’s run method to be called in that separately executing thread.
The general contract of the method run is that it may take any action whatsoever.