IfFlowDsl

interface IfFlowDsl : AutomationFlowContributor

Known direct subclasses
SequentialFlowBuilder

Type-safe builder that builds a SequentialFlow Node.


Interface for constructing conditional flow nodes, starting with an IfChain and potentially concluding as an IfFlow, and contributing them to an automation flow.

An IfChain represents an in-progress conditional structure, consisting of an initial ifThen and zero or more elseIf clauses. An IfFlow is a complete conditional structure, which is formed when an orElse clause is added to an IfChain.

Summary

Public functions

open IfChain

Extends the current IfChain by adding an elseIf clause.

open IfChain

Starts a conditional block by building an IfChain with an initial ifThen clause and adding it to the flow.

open Unit

Completes the conditional block by adding a final orElse clause to the IfChain.

Public functions

elseIf

@CanIgnoreReturnValue
open fun IfChain.elseIf(condition: TypedExpression<Boolean>, then: SequentialFlowBuilder.() -> Unit): IfChain

Extends the current IfChain by adding an elseIf clause. This allows for multiple conditional branches. Returns a new IfChain instance representing the updated conditional structure.

Parameters
condition: TypedExpression<Boolean>

The Boolean expression for the elseIf clause.

then: SequentialFlowBuilder.() -> Unit

The Node to execute if the condition is true.

Returns
IfChain

A new IfChain instance including the added elseIf clause.

ifThen

@CanIgnoreReturnValue
open fun ifThen(condition: TypedExpression<Boolean>, then: SequentialFlowBuilder.() -> Unit): IfChain

Starts a conditional block by building an IfChain with an initial ifThen clause and adding it to the flow. The returned IfChain can be extended with elseIf or finalized with orElse.

Parameters
condition: TypedExpression<Boolean>

The Boolean expression for the ifThen clause.

then: SequentialFlowBuilder.() -> Unit

The Node to execute if the condition is true.

Returns
IfChain

The created IfChain instance, which can be used to add elseIf or orElse clauses.

orElse

open fun IfChain.orElse(elseThen: SequentialFlowBuilder.() -> Unit): Unit

Completes the conditional block by adding a final orElse clause to the IfChain. This transforms the IfChain into a fully formed IfFlow within the automation graph. Once orElse is called, no further elseIf or orElse can be added to this specific conditional structure.

Parameters
elseThen: SequentialFlowBuilder.() -> Unit

The Node to execute if none of the preceding ifThen or elseIf conditions are true.