Class TypeCastValidator<T, TDestination, TResult>
- Namespace
- LfrlAnvil.Validation.Validators
- Assembly
- LfrlAnvil.Validation.dll
Represents a generic object validator that casts validated objects to TDestination type
and performs conditional validation based on that type cast.
public sealed class TypeCastValidator<T, TDestination, TResult> : IValidator<T, TResult>
Type Parameters
TObject type.
TDestinationObject type required for IfIsOfType validator invocation.
TResultResult type.
- Inheritance
-
TypeCastValidator<T, TDestination, TResult>
- Implements
-
IValidator<T, TResult>
- Inherited Members
- Extension Methods
Constructors
TypeCastValidator(IValidator<TDestination, TResult>, IValidator<T, TResult>)
Creates a new TypeCastValidator<T, TDestination, TResult> instance.
public TypeCastValidator(IValidator<TDestination, TResult> ifIsOfType, IValidator<T, TResult> ifIsNotOfType)
Parameters
ifIsOfTypeIValidator<TDestination, TResult>Underlying validator invoked when validated object is of
TDestinationtype.ifIsNotOfTypeIValidator<T, TResult>Underlying validator invoked when validated object is not of
TDestinationtype.
Properties
IfIsNotOfType
Underlying validator invoked when validated object is not of TDestination type.
public IValidator<T, TResult> IfIsNotOfType { get; }
Property Value
- IValidator<T, TResult>
IfIsOfType
Underlying validator invoked when validated object is of TDestination type.
public IValidator<TDestination, TResult> IfIsOfType { get; }
Property Value
- IValidator<TDestination, TResult>
Methods
Validate(T)
Validates the provided obj.
[Pure]
public Chain<TResult> Validate(T obj)
Parameters
objTObject to validate.
Returns
- Chain<TResult>
Result of
objvalidation.