Class TasksHandler.Builder

java.lang.Object
org.springframework.statemachine.recipes.tasks.TasksHandler.Builder
Enclosing class:
TasksHandler

public static class TasksHandler.Builder extends Object
Builder pattern implementation building a TasksHandler.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • task

      public TasksHandler.Builder task(Object id, Runnable runnable)
      Define a top-level task.
      Parameters:
      id - the id
      runnable - the runnable
      Returns:
      the builder for chaining
    • task

      public TasksHandler.Builder task(Object parent, Object id, Runnable runnable)
      Define a sub-task with a reference to its parent.
      Parameters:
      parent - the parent
      id - the id
      runnable - the runnable
      Returns:
      the builder for chaining
    • persist

      Define a StateMachinePersist implementation if state machine should be persisted with state changes.
      Parameters:
      persist - the persist
      Returns:
      the builder for chaining
    • listener

      Define a TasksHandler.TasksListener to be registered.
      Parameters:
      listener - the tasks listener
      Returns:
      the builder for chaining
    • taskExecutor

      public TasksHandler.Builder taskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
      Define a TaskExecutor to be used. Default executor will be a ThreadPoolTaskExecutor set with a thread pool size of a top-level task count.
      Parameters:
      taskExecutor - the task executor
      Returns:
      the builder for chaining
    • build

      public TasksHandler build()
      Builds the TasksHandler.
      Returns:
      the tasks handler