OptionalRuleChainer

class OptionalRuleChainer<V>(val message: () -> String) : ValidationRule<V?>

A rule that chains non-optional rules. If the value is not null, the rule set is applied to the value.

Constructors

Link copied to clipboard
constructor(message: () -> String)

Creates a new instance of OptionalRuleChainer.

Properties

Link copied to clipboard
val message: () -> String

The message to return when the value is null.

Functions

Link copied to clipboard
open override fun test(value: V?): FieldErrors

Tests the given value against this rule.

Link copied to clipboard
infix fun then(block: ValidationRuleBuilder<V>.() -> Unit)

Chains a set of rules to the non-optional value.