FF4kBuilder

Root DSL builder for configuring an FF4k instance.

This class represents the root scope of the FF4k Kotlin DSL. It is used to declaratively register features and properties into an FF4k engine using structured, type-safe Kotlin blocks.

Instances of this builder are not created manually. Instead, an instance is provided as the receiver of the ff4k DSL function.

DSL structure overview

val ff4k = ff4k {
feature(existingFeature)

features {
feature("dark-mode") {
isEnabled = true
}
}

properties {
property("max-retries") {
value = 3
}
}
}

Execution model

All mutation methods on this builder are declared as suspend functions. This allows FF4k to support asynchronous or remote implementations of FeatureStore and PropertyStore.

The DSL block is executed sequentially, and all side effects are applied immediately to the underlying FF4k instance.

DSL scoping

This class is annotated with FF4kDsl to prevent accidental receiver leakage when nesting DSL blocks (e.g. feature builders inside the root DSL).

Functions

Link copied to clipboard
suspend fun feature(feature: Feature)

Registers an already constructed Feature instance.

Link copied to clipboard
suspend fun features(block: FeaturesBuilder.() -> Unit)

Registers multiple features using a nested DSL block.

Link copied to clipboard
suspend fun properties(block: PropertiesBuilder.() -> Unit)

Registers multiple properties using a nested DSL block.

Link copied to clipboard
suspend fun property(property: Property<*>)

Registers an already constructed Property instance.