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
-
Method Summary
Modifier and TypeMethodDescriptionofCallable
(Callable<? extends T> callable) Creates aTask
from aCallable
.ofCallback
(Callback callback) Creates aTask
from aCallback
.static Task
<Void, RuntimeException> ofRunnable
(Runnable runnable) Creates aTask
from aRunnable
.abstract T
run()
The method that must contain the body of theTask
.toString()
-
Constructor Details
-
Task
public Task()Creates a newTask
. -
Task
Creates a newTask
with the given name.- Parameters:
name
- the name
-
-
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 aTask
from aRunnable
.- Parameters:
runnable
- the wrapped object- Returns:
- the
Task
- Since:
- 3.2-ALPHA-1 (was previously on
Task8
-
ofCallable
Creates aTask
from 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 aTask
from aCallback
.- Parameters:
callback
- the wrapped object- Returns:
- the
Task
- Since:
- 3.2-ALPHA-1 (was previously on
Task8
-