Table of Contents

Class ForDefaultIfNullRefValidator<T, TResult>

Namespace
LfrlAnvil.Validation.Validators
Assembly
LfrlAnvil.Validation.dll

Represents a generic object validator which uses specified DefaultValue when validated object is null.

public sealed class ForDefaultIfNullRefValidator<T, TResult> : IValidator<T?, TResult> where T : class

Type Parameters

T

Object type.

TResult

Result type.

Inheritance
ForDefaultIfNullRefValidator<T, TResult>
Implements
IValidator<T, TResult>
Inherited Members
Extension Methods

Constructors

ForDefaultIfNullRefValidator(IValidator<T, TResult>, T)

public ForDefaultIfNullRefValidator(IValidator<T, TResult> validator, T defaultValue)

Parameters

validator IValidator<T, TResult>

Underlying validator.

defaultValue T

Default value to use instead of a null object.

Properties

DefaultValue

Default value to use instead of a null object.

public T DefaultValue { get; }

Property Value

T

Validator

Underlying validator.

public IValidator<T, TResult> Validator { get; }

Property Value

IValidator<T, TResult>

Methods

Validate(T?)

Validates the provided obj.

[Pure]
public Chain<TResult> Validate(T? obj)

Parameters

obj T

Object to validate.

Returns

Chain<TResult>

Result of obj validation.