isBetween

@JvmName(name = "shortIsBetween")
fun Validatable<Short?>.isBetween(range: IntRange): Constraint
@JvmName(name = "closedFloatIsBetween")
fun Validatable<Float?>.isBetween(range: ClosedFloatingPointRange<Float>): Constraint
@JvmName(name = "closedDoubleIsBetween")
fun Validatable<Double?>.isBetween(range: ClosedFloatingPointRange<Double>): Constraint
@JvmName(name = "openFloatIsBetween")
fun Validatable<Float?>.isBetween(range: OpenEndRange<Float>): Constraint
@JvmName(name = "openDoubleIsBetween")
fun Validatable<Double?>.isBetween(range: OpenEndRange<Double>): Constraint


The validatable Duration must be in range (lower and upper bounds included) when this constraint is applied.

Code example:

val validate = Validator<Duration> {
val max = 10.seconds
isBetween(Duration.ZERO..max)
}
validate(5.seconds) // Success
validate(10.seconds) // Success
validate(15.seconds) // Failure (message: Must be between 0s and 10s (inclusive))

The validatable Duration must be in range (upper bound excluded) when this constraint is applied.

Code example:

val validate = Validator<Duration> {
val max = 10.seconds
isBetween(Duration.ZERO..<max)
}
validate(5.seconds) // Success
validate(10.seconds) // Failure (message: Must be between 0s and 10s (exclusive))
validate(15.seconds) // Failure (message: Must be between 0s and 10s (exclusive))