Adapts this validator to a type U
.
Adapts this validator to a type U
. Each application of the new validator applies the the specified
extractor function, and validates the resulting T
via this validator. This enables explicit validator
composition, which is especially useful for defining new, complex combinators. At the validator definition
site, it is recommended to use the valid
operation provided by the DSL instead.
Important note: since there is no way to enforce null-safety at the type system level, the specified extractor function must be able to safely handle nulls.
The target type of the adaption.
An extractor function from U => T
.
An adapted validator of U
.
A validator is a function
T => Result
, whereT
is the type of the object under validation and Result is an instance of com.wix.accord.Result.Implementation note: While theoretically a validator can be defined as a type alias, in practice this doesn't allow to specify an error message when it's implicitly missing at the call site (see scala.annotation.implicitNotFound).
The object type this validator operates on.