validate

fun validate(message: String = "Invalid value for @name: @value", predicate: (T) -> Boolean): NonNullableOptionBuilder<T>(source)

Adds validation for this option's value. The validation is applied to the parsed non-null value.

Return

This builder for method chaining

Parameters

message

Error message template. Supports placeholders: @name, @value, @switches

predicate

Function that returns true if the value is valid


fun validate(vararg validations: Pair<String, (T) -> Boolean>): NonNullableOptionBuilder<T>(source)

Adds multiple validations for this option's value. All validations are applied to the parsed non-null value.

Return

This builder for method chaining

Parameters

validations

Pairs of (error message template, validation predicate)