Package it.tidalwave.util
Class Task<T,E extends java.lang.Throwable>
- java.lang.Object
-
- it.tidalwave.util.Task<T,E>
-
- Direct Known Subclasses:
SimpleTask
public abstract class Task<T,E extends java.lang.Throwable> extends java.lang.Object
A class which encapsulates a task.- Author:
- Fabrizio Giudici
- Status: experimental API
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T> Task<T,java.lang.Exception>
ofCallable(java.util.concurrent.Callable<? extends T> callable)
Creates aTask
from aCallable
.static Task<java.lang.Void,java.lang.Throwable>
ofCallback(Callback callback)
Creates aTask
from aCallback
.static Task<java.lang.Void,java.lang.RuntimeException>
ofRunnable(java.lang.Runnable runnable)
Creates aTask
from aRunnable
.abstract T
run()
The method that must contain the body of theTask
.java.lang.String
toString()
-
-
-
Method Detail
-
run
public abstract T run() throws E extends java.lang.Throwable
The method that must contain the body of theTask
.
-
toString
@Nonnull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
ofRunnable
@Nonnull public static Task<java.lang.Void,java.lang.RuntimeException> ofRunnable(@Nonnull java.lang.Runnable runnable)
Creates aTask
from aRunnable
.- Parameters:
runnable
- the wrapped object- Returns:
- the
Task
- Since:
- 3.2-ALPHA-1 (was previously on
Task8
-
ofCallable
@Nonnull public static <T> Task<T,java.lang.Exception> ofCallable(@Nonnull java.util.concurrent.Callable<? extends T> callable)
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
-
-