Class MappedValidator<T, TSourceResult, TResult>
- Namespace
- LfrlAnvil.Validation.Validators
- Assembly
- LfrlAnvil.Validation.dll
Represents a generic object validator that maps result of an underlying validator to a different type.
public sealed class MappedValidator<T, TSourceResult, TResult> : IValidator<T, TResult>
Type Parameters
T
Object type.
TSourceResult
Underlying validator's result type.
TResult
Result type.
- Inheritance
-
MappedValidator<T, TSourceResult, TResult>
- Implements
-
IValidator<T, TResult>
- Inherited Members
- Extension Methods
Constructors
MappedValidator(IValidator<T, TSourceResult>, Func<Chain<TSourceResult>, Chain<TResult>>)
Creates a new MappedValidator<T, TSourceResult, TResult> instance.
public MappedValidator(IValidator<T, TSourceResult> validator, Func<Chain<TSourceResult>, Chain<TResult>> resultMapper)
Parameters
validator
IValidator<T, TSourceResult>Underlying validator.
resultMapper
Func<Chain<TSourceResult>, Chain<TResult>>Underlying validator's result mapper.
Properties
ResultMapper
Underlying validator's result mapper.
public Func<Chain<TSourceResult>, Chain<TResult>> ResultMapper { get; }
Property Value
Validator
Underlying validator.
public IValidator<T, TSourceResult> Validator { get; }
Property Value
- IValidator<T, TSourceResult>
Methods
Validate(T)
Validates the provided obj
.
[Pure]
public Chain<TResult> Validate(T obj)
Parameters
obj
TObject to validate.
Returns
- Chain<TResult>
Result of
obj
validation.