Package com.yworkflow.common
Interface WorkflowCallable<R,T extends Throwable>
- Type Parameters:
R- the type of the result of the callableT- the type of exception that may be thrown
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface that represents a task that returns a result and potentially throws a
checked exception. This is similar to Java's
Callable but allows for
checked exceptions.- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncall()Computes a result, or throws an exception if unable to do so.static <R,T extends Throwable>
WorkflowCallable<R, T> noReturn(WorkflowRunnable<T> runnable) Creates a WorkflowCallable from a WorkflowRunnable.
-
Method Details
-
call
Computes a result, or throws an exception if unable to do so.- Returns:
- computed result
- Throws:
T- if unable to compute a result
-
noReturn
Creates a WorkflowCallable from a WorkflowRunnable. The returned callable will execute the runnable and return null.- Type Parameters:
R- the return type (will be null)T- the exception type- Parameters:
runnable- the runnable to convert- Returns:
- a callable that executes the runnable and returns null
-