validatingFrom

fun <F, T> Converter<F, T>.validatingFrom(validate: (F) -> Unit): Converter<F, T>

Adds validation before conversions by running validate on F values before converting them to type T. Validators are expected to throw an exception if the expected condition is not met.

Parameters

F

The type being converted from

T

The type being converted to

validate

A function which accepts an F value and throws an exception if the expected condition is not met