Interface Task<C extends FlowContext>

Type Parameters:
C - the type of the context shared between tasks
All Known Implementing Classes:
ParallelTasks, RepeatTask, SequentialTasks
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Task<C extends FlowContext>
Interface for the execution of an asynchronous task.

Task implementations can use FlowContext.resolve(), FlowContext.resolve(Object) and FlowContext.resolve(String, Object) as a shortcut to push or put a value on the stack or the map and return a resolved promise.

In case of an error task implementations can use FlowContext.reject(Object) to return a rejected promise. Rejected promises are caught by the enclosing Flow methods and returned as a resolved promise.

  • Method Summary

    Modifier and Type
    Method
    Description
    elemental2.promise.Promise<C>
    apply(C context)
    Executes the task.
  • Method Details

    • apply

      elemental2.promise.Promise<C> apply(C context)
      Executes the task.
      Parameters:
      context - the context shared between tasks
      Returns:
      a promise containing the shared context