given

fun <R : ValidationRule<T>> R.given(precondition: (T?) -> Boolean, rule: R.() -> R): R(source)

Validate rule only if precondition evaluates to true.

Return

The original rule on which this method has been invoked.

Parameters

precondition

The predicate which should hold for rule to be validated.

rule

The rule which should hold when precondition evaluates to true.