public class AsyncHandler<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
AsyncHandler<java.lang.Void> |
consumeOnExecutorThread(java.util.function.Consumer<T> consumer)
accepts an
Consumer to be applyed on worker thread. |
AsyncHandler<java.lang.Void> |
consumeOnFXThread(java.util.function.Consumer<T> consumer)
accepts an
Consumer to be applyed on JavaFX application thread. |
void |
execute()
the terminal execute method which starts the execution chain
|
void |
execute(java.util.function.Consumer<T> r)
the terminal execute method which starts the execution chain.
|
void |
execute(java.lang.Runnable r)
the terminal execute method which starts the execution chain.
|
<V> AsyncHandler<V> |
functionOnExecutorThread(java.util.function.Function<T,V> function)
accepts an
Function to be applyed on worker thread. |
<V> AsyncHandler<V> |
functionOnFXThread(java.util.function.Function<T,V> function)
accepts an
Function to be applyed on JavaFX application thread. |
static <T> AsyncHandler |
getInstance()
Returns an instace of async handler
|
<T> AsyncHandler<T> |
supplyOnExecutorThread(java.util.function.Supplier<T> supplier)
accepts an
Supplier to be applyed on worker thread. |
<T> AsyncHandler<T> |
supplyOnFXThread(java.util.function.Supplier<T> supplier)
accepts an
Supplier to be applyed on JavaFX application thread. |
public static <T> AsyncHandler getInstance()
, - the type of returnpublic AsyncHandler<java.lang.Void> consumeOnFXThread(java.util.function.Consumer<T> consumer)
Consumer to be applyed on JavaFX application thread.
This method ensures the invocation on the FX thread even when the execution started in an different thread.consumer - , the consumer to executeAsyncHandlerpublic <T> AsyncHandler<T> supplyOnFXThread(java.util.function.Supplier<T> supplier)
Supplier to be applyed on JavaFX application thread. This method ensures the invocation on the FX thread even when the execution started in an different thread and returnes a value of type T.T - the return typesupplier - the supplier to executeAsyncHandlerpublic <V> AsyncHandler<V> functionOnFXThread(java.util.function.Function<T,V> function)
Function to be applyed on JavaFX application thread.V - the type of returnfunction - the function to executeAsyncHandlerpublic AsyncHandler<java.lang.Void> consumeOnExecutorThread(java.util.function.Consumer<T> consumer)
Consumer to be applyed on worker thread.consumer - the consumer to executeAsyncHandlerpublic <T> AsyncHandler<T> supplyOnExecutorThread(java.util.function.Supplier<T> supplier)
Supplier to be applyed on worker thread.T - the type of returnsupplier - the supplier to executeAsyncHandlerpublic <V> AsyncHandler<V> functionOnExecutorThread(java.util.function.Function<T,V> function)
Function to be applyed on worker thread.V - the type of returnfunction - the function to executeAsyncHandlerpublic void execute()
public void execute(java.lang.Runnable r)
r - the supplied runnable will be invoked on fx application thread when the chain has finishedpublic void execute(java.util.function.Consumer<T> r)
r - the supplied consumer will be invoked on fx application thread when the chain has finished, the input of the consumer is the last output of your execution chain