field
Starts defining a field configuration using method chaining.
This method returns a FieldConfigScope that can be configured using method chaining. All configuration methods return the scope itself, allowing fluent API usage.
Example:
field(AppConfig::port)
.default(8080)
.range(1..65535)
.validate { it > 0 }Content copied to clipboard
Return
a FieldConfigScope for method chaining
Parameters
prop
the property reference for the field to configure
Defines a field configuration using a DSL block.
This method provides a traditional block-style DSL for configuring fields. The provided lambda receives a FieldConfigScope as its receiver, allowing direct calls to configuration methods.
Example:
field(AppConfig::apiKey) {
required()
validate { it.isNotBlank() }
}Content copied to clipboard
Parameters
prop
the property reference for the field to configure
block
a lambda with FieldConfigScope receiver for configuration