FieldConfigScope

Provides a DSL-style builder to configure fields in a configuration schema.

This class allows defining field-specific properties, validation logic, and custom behavior for configuration loading and parsing. It supports defining default values, marking fields as required, setting value ranges, and adding custom deserialization logic.

Parameters

V

the type of the value associated with this field

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Builds a definition for a configuration field based on the provided property and the settings specified within the FieldConfigScope.

Link copied to clipboard
fun default(value: V)

Sets the default value for the configuration field.

Link copied to clipboard
fun ifNull(handler: KClass<out ErrorHandlerWith>)

Sets a handler to be used when the configuration field is null.

Link copied to clipboard
fun loader(loader: FieldLoader)

Sets a custom loader for the configuration field.

Link copied to clipboard
fun name(yamlName: String)
Link copied to clipboard
fun range(min: Long = Long.MIN_VALUE, max: Long = Long.MAX_VALUE)

Sets a range validator for the configuration field.

Link copied to clipboard
fun required(soft: Boolean = false)

Marks the field as required or soft-required during configuration validation.

Link copied to clipboard
fun validate(block: (V) -> Unit)

Adds a custom validator for the configuration field.