FeatureBuilder

DSL builder used to define a single feature in the FF4K configuration.

A feature represents a toggleable capability that can be enabled or disabled, grouped, protected by permissions, and controlled by a flipping strategy.

Instances of this builder are created internally by the FF4K DSL and are not intended to be instantiated directly.

Example:

feature("new-ui") {
isEnabled = true
description = "Enables the new UI experience"
group = "ui"

permissions("ADMIN", "BETA_USER")

property<String>("theme") {
value = "dark"
}
}

Properties

Link copied to clipboard

Optional human-readable description of the feature.

Link copied to clipboard

Optional strategy used to dynamically determine feature enablement.

Link copied to clipboard

Optional logical group name for the feature.

Link copied to clipboard

Whether the feature is enabled by default.

Functions

Link copied to clipboard

Configures an AllowListStrategy for this feature.

Link copied to clipboard

Configures a ClientFilterStrategy for this feature.

Link copied to clipboard
fun FeatureBuilder.dailyHoursStrategy(startHour: Int, endHour: Int, timezone: TimeZone = TimeZone.UTC)

Configures a DailyHoursStrategy for this feature.

Link copied to clipboard
fun FeatureBuilder.dateRangeStrategy(startDate: String, endDate: String)

Configures a DateRangeStrategy for this feature using ISO-8601 date strings.

fun FeatureBuilder.dateRangeStrategy(startDate: Instant, endDate: Instant)

Configures a DateRangeStrategy for this feature using Instant values.

fun FeatureBuilder.dateRangeStrategy(startDate: LocalDateTime, endDate: LocalDateTime, timezone: TimeZone = TimeZone.UTC)

Configures a DateRangeStrategy for this feature using LocalDateTime values and timezone.

Link copied to clipboard

Configures a DenyListStrategy for this feature.

Link copied to clipboard
fun permission(name: String)

Adds a single permission required to access this feature.

Link copied to clipboard

Adds permissions using a dedicated permissions DSL block.

fun permissions(vararg names: String)

Adds multiple permissions required to access this feature.

Link copied to clipboard

Configures a PonderationStrategy for this feature with a decimal weight.

Configures a PonderationStrategy for this feature with an integer percentage.

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

Attaches a pre-built custom property to this feature.

fun <T> property(name: String, block: PropertyBuilder<T>.() -> Unit)

Defines and attaches a custom property using a property DSL block.

Link copied to clipboard

Configures a RegionFilterStrategy for this feature.

Link copied to clipboard

Configures a ReleaseDateStrategy for this feature using an ISO-8601 date string.

fun FeatureBuilder.releaseDateStrategy(releaseDate: Instant)

Configures a ReleaseDateStrategy for this feature using an Instant.

fun FeatureBuilder.releaseDateStrategy(dateTime: LocalDateTime, timezone: TimeZone = TimeZone.UTC)

Configures a ReleaseDateStrategy for this feature using a LocalDateTime and timezone.

Link copied to clipboard

Configures a ServerFilterStrategy for this feature.

Link copied to clipboard

Configures a UserPonderationStrategy for this feature with a decimal weight.

Configures a UserPonderationStrategy for this feature with an integer percentage.

Link copied to clipboard
fun FeatureBuilder.weekdayStrategy(timezone: TimeZone = TimeZone.UTC, block: WeekdayBuilder.() -> Unit)

Configures a WeekdayStrategy for this feature using a DSL builder.