FixedValuesBuilder

DSL builder for defining a set of allowed, immutable values for a property.

Use this builder inside a PropertyBuilder to specify which values are valid for the property. Duplicate values are automatically removed.

The builder supports the unary plus operator (+) and add function to add values to the set.

Example

val allowedLevels = FixedValuesBuilder<String>().apply {
+"DEBUG"
+"INFO"
+"WARN"
+"ERROR"
}.build()

When used in a property DSL:

property("log-level") {
value = "INFO"
fixedValues {
+"DEBUG"
+"INFO"
+"WARN"
+"ERROR"
}
}

Parameters

T

Type of the values in the set

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun add(value: T)

Adds a value to the collector explicitly.

Link copied to clipboard
operator fun T.unaryPlus()

Adds this value to the collector.