OptionBuilder

Builds a value-bearing option. The call you end with decides the property's type:

  • end here and the property is nullable, resolving to null when the option is absent;

  • required and default give a non-null value;

  • multiple collects repeats into a List<T>.

Refine the value type (.int(), .enum<E>(), .convert(...)) before choosing cardinality.

Type Parameters

T

the option's value type.

Functions

Link copied to clipboard

Parses the value as a Boolean: true/false, 1/0, yes/no, y/n, or on/off.

Link copied to clipboard
fun <R : Any> convert(converter: Converter<R>): OptionBuilder<R>
Link copied to clipboard

Uses value when the option is absent.

Link copied to clipboard
Link copied to clipboard
inline fun <E : Enum<E>> enum(): OptionBuilder<E>

Parses the value as the enum E, matching constant names case-insensitively.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Allows the option to repeat, collecting every occurrence into a List<T>.

Link copied to clipboard
open operator override fun provideDelegate(thisRef: Arguments, property: KProperty<*>): ReadOnlyProperty<Arguments, T?>
Link copied to clipboard

Requires the option; parsing fails when it is absent.