fun <T> ProcessedArgument<T, T>.restrictTo(min: T? = null, max: T? = null, clamp: Boolean = false): ProcessedArgument<T, T> where T : Number, T : Comparable<T>
Restrict the argument values to fit into a range.
By default, conversion fails if the value is outside the range, but if clamp is true, the value will be silently clamped to fit in the range.
Example:
argument().int().restrictTo(max=10, clamp=true)
fun <T> ProcessedArgument<T, T>.restrictTo(range: ClosedRange<T>, clamp: Boolean = false): ProcessedArgument<T, T> where T : Number, T : Comparable<T>
Restrict the argument values to fit into a range.
By default, conversion fails if the value is outside the range, but if clamp is true, the value will be silently clamped to fit in the range.
Example:
argument().int().restrictTo(1..10, clamp=true)
fun <T> OptionWithValues<T?, T, T>.restrictTo(min: T? = null, max: T? = null, clamp: Boolean = false): OptionWithValues<T?, T, T> where T : Number, T : Comparable<T>
Restrict the option values to fit into a range.
By default, conversion fails if the value is outside the range, but if clamp is true, the value will be silently clamped to fit in the range.
Example:
option().int().restrictTo(max=10, clamp=true)
fun <T> OptionWithValues<T?, T, T>.restrictTo(range: ClosedRange<T>, clamp: Boolean = false): OptionWithValues<T?, T, T> where T : Number, T : Comparable<T>
Restrict the option values to fit into a range.
By default, conversion fails if the value is outside the range, but if clamp is true, the value will be silently clamped to fit in the range.
Example:
option().int().restrictTo(1..10, clamp=true)