Switch

fun Switch(definition: Class<out SwitchTask>): SwitchRef

Declares a task that chooses one of several tasks to run; every other one is skipped.

The task's ID is the class's simple name with its first character lowercased, so PickPath.class becomes pickPath. Use Switch(id, definition) to set it, and SwitchRef.config for the task's other settings:

dag.Switch(PickPath.class).Case(handleLong).Case(handleShort);

Return

The switch, to list its cases on.

Parameters

definition

Class that implements SwitchTask. Must have a public no-arg constructor.

Throws

if a task with the same ID is already registered.


fun Switch(id: String, definition: Class<out SwitchTask>): SwitchRef

Declares a task that chooses one of several tasks to run, under the task ID id.

Return

The switch, to list its cases on.

Parameters

id

Task identifier, unique within this Dag.

definition

Class that implements SwitchTask. Must have a public no-arg constructor.

See also

Throws

if a task with the same ID is already registered.