IntRangeValidator

open class IntRangeValidator(range: IntRange) : Validator<Int>

Base for Int range validators: the value must be in range.

@Validate can only reference object validators, so subclass with concrete arguments:

object QuantityValidator : IntRangeValidator(1..999)

Constructors

Link copied to clipboard
constructor(range: IntRange)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun validate(value: Int): String?

Returns null if value is valid, or a human-readable reason string if invalid.