Package it.tidalwave.util
Class Task<T,E extends Throwable>
java.lang.Object
it.tidalwave.util.Task<T,E>
- Direct Known Subclasses:
SimpleTask
A class which encapsulates a task.
- Author:
- Fabrizio Giudici
- Status: experimental API
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionofCallable(Callable<? extends T> callable) Creates aTaskfrom aCallable.ofCallback(Callback callback) Creates aTaskfrom aCallback.static Task<Void, RuntimeException> ofRunnable(Runnable runnable) Creates aTaskfrom aRunnable.abstract Trun()The method that must contain the body of theTask.toString()
-
Constructor Details
-
Method Details
-
run
The method that must contain the body of theTask.- Returns:
- the computed value
- Throws:
E- in case of error
-
toString
-
ofRunnable
Creates aTaskfrom aRunnable.- Parameters:
runnable- the wrapped object- Returns:
- the
Task - Since:
- 3.2-ALPHA-1 (was previously on
Task8
-
ofCallable
Creates aTaskfrom aCallable.- Type Parameters:
T- the return type of the callable- Parameters:
callable- the wrapped object- Returns:
- the
Task - Since:
- 3.2-ALPHA-1 (was previously on
Task8
-
ofCallback
Creates aTaskfrom aCallback.- Parameters:
callback- the wrapped object- Returns:
- the
Task - Since:
- 3.2-ALPHA-1 (was previously on
Task8
-