range

fun range(min: Long = Long.MIN_VALUE, max: Long = Long.MAX_VALUE): FieldConfigScope<V>

Sets a range validator for the configuration field using explicit min/max values.

The range validator ensures that the field value is within the specified minimum and maximum bounds. If the field value is out of the defined range, a validation error is triggered. This validation applies to numeric types (e.g., Int, Long, Float, Double).

Example:

field(AppConfig::port).range(min = 1, max = 65535)

Return

this FieldConfigScope for method chaining

Parameters

min

the minimum permissible value for the field (default is Long.MIN_VALUE)

max

the maximum permissible value for the field (default is Long.MAX_VALUE)


Sets a range validator for the configuration field using a LongRange.

This is a convenience overload that accepts a Kotlin range object.

Example:

field(AppConfig::port).range(1L..65535L)

Return

this FieldConfigScope for method chaining

Parameters

range

the valid range for the field value


Sets a range validator for the configuration field using an IntRange.

This is a convenience overload for integer ranges.

Example:

field(AppConfig::port).range(1..65535)

Return

this FieldConfigScope for method chaining

Parameters

range

the valid range for the field value