ValidationRuleBuilder

Builder for creating a set of validation rules.

Parameters

V

The type of the value to be validated.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Builds the set of rules.

Link copied to clipboard
fun <V : Any, S> ObjectRuleBuilder<V>.cast(transform: (V) -> S): ObjectRuleChainer<V, S>

Chains a transformation function with a set of rules.

Link copied to clipboard

Adds a rule to the set of rules.

Link copied to clipboard
fun BooleanRuleBuilder.isFalse(message: () -> String)

Validates that the boolean value is false.

Link copied to clipboard
fun DoubleRuleBuilder.isNaN(message: () -> String)

Validates that the double value is NaN.

fun FloatRuleBuilder.isNaN(message: () -> String)

Validates that the float value is NaN.

Link copied to clipboard
fun BooleanRuleBuilder.isTrue(message: () -> String)

Validates that the boolean value is true.

Link copied to clipboard
fun DoubleRuleBuilder.maximum(limit: Double, message: () -> String)

Validates that the double value is less than or equal to limit.

fun FloatRuleBuilder.maximum(limit: Float, message: () -> String)

Validates that the float value is less than or equal to limit.

fun IntRuleBuilder.maximum(limit: Int, message: () -> String)

Validates that the integer value is less than or equal to limit.

fun LongRuleBuilder.maximum(limit: Long, message: () -> String)

Validates that the long value is less than or equal to limit.

Link copied to clipboard
fun StringRuleBuilder.maxLength(limit: Int, message: () -> String)

Validates that the string length is no more than limit characters.

Link copied to clipboard
fun <V> ArrayRuleBuilder<V>.maxSize(limit: Int, message: () -> String)

Validates that the array size is no more than limit.

fun <V> CollectionRuleBuilder<V>.maxSize(limit: Int, message: () -> String)

Validates that the collection size is no more than limit.

Link copied to clipboard
fun DoubleRuleBuilder.minimum(limit: Double, message: () -> String)

Validates that the double value is greater than or equal to limit.

fun FloatRuleBuilder.minimum(limit: Float, message: () -> String)

Validates that the float value is greater than or equal to limit.

fun IntRuleBuilder.minimum(limit: Int, message: () -> String)

Validates that the integer value is greater than or equal to limit.

fun LongRuleBuilder.minimum(limit: Long, message: () -> String)

Validates that the long value is greater than or equal to limit.

Link copied to clipboard
fun StringRuleBuilder.minLength(limit: Int, message: () -> String)

Validates that the string length is at least limit characters.

Link copied to clipboard
fun <V> ArrayRuleBuilder<V>.minSize(limit: Int, message: () -> String)

Validates that the array size is at least limit.

fun <V> CollectionRuleBuilder<V>.minSize(limit: Int, message: () -> String)

Validates that the collection size is at least limit.

Link copied to clipboard
fun StringRuleBuilder.notBlank(message: () -> String)

Validates that the string value is not blank.

Link copied to clipboard
fun <V> ArrayRuleBuilder<V>.notEmpty(message: () -> String)

Validates that the array is not empty.

fun StringRuleBuilder.notEmpty(message: () -> String)

Validates that the string value is not empty.

fun <V> CollectionRuleBuilder<V>.notEmpty(message: () -> String)

Validates that the collection is not empty.

Link copied to clipboard
fun DoubleRuleBuilder.notNaN(message: () -> String)

Validates that the double value is not NaN.

fun FloatRuleBuilder.notNaN(message: () -> String)

Validates that the float value is not NaN.

Link copied to clipboard

Validates that the optional value is not null.

Link copied to clipboard
fun StringRuleBuilder.pattern(pattern: String, message: () -> String)
fun StringRuleBuilder.pattern(pattern: Regex, message: () -> String)

Validates that the string matches the pattern.

Link copied to clipboard
fun <V : Any> ObjectRuleBuilder<V>.test(predicate: V.() -> Boolean, message: () -> String)

Validates that the object value passes the given predicate.