cast

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

Chains a transformation function with a set of rules.

Usage:

rules<String> {
notBlank { "must be not blank" }
cast { it.length } then {
minimum(3) { "must be at least 3 characters" }
maximum(20) { "must be at most 20 characters" }
}
}

Parameters

transform

The transformation function to apply to the object value.