Validator

Description

sealed class Tinman.Core.Validating.Validator

Derived from

EnumerableBase<ValidateMessage> abstract
IVersioned

A utility class for validating object graphs and reporting error and warning messages.

The IVersioned.Version property returns the message count ( CountMessages).

Public / Constructors

Validator


public constructor Validator → ()

Creates a new instance of Validator.

Public / Methods

Begin​Context


public method BeginContext → (1)

context in : object

[not-null]
The context object.

Uses the given context object for subsequent validation.

See also

Validator.End

Begin​Entry


public method BeginEntry → (1)

name in : string

[not-empty]
The entry name.

A named entry of the current value is about to be validated.

See also

Validator.End

Begin​Index


public method BeginIndex → (1)

index in : int32

[>=0]
The element index.

A list or array element of the current value is about to be validated.

See also

Validator.End

Begin​Member


public method BeginMember → (1)

name in : string

[not-empty]
The member name.

A named member of the current value is about to be validated.

See also

Validator.End

Clear


public method Clear → ()

Clears the state of this validator.

End


public method End → ()

Validation of the most recent element has finished.

Message


public method Message → (2)

message in : ValidateMessage

[not-null]
The message.

context opt : object = null

The context object or null.

Emits a validation message.

Message​Entry


public method MessageEntry → (3)

name in : string

[not-empty]
The entry name.

message in : ValidateMessage

[not-null]
The message.

context opt : object = null

The context object or null.

Emits a validation message for a named entry.

Message​Index


public method MessageIndex → (3)

index in : int32

[>=0]
The element index.

message in : ValidateMessage

[not-null]
The message.

context opt : object = null

The context object or null.

Emits a validation message for an array element.

Message​Member


public method MessageMember → (3)

name in : string

[not-empty]
The member name.

message in : ValidateMessage

[not-null]
The message.

context opt : object = null

The context object or null.

Emits a validation message for a named member.

Messages

2 overloads


public method Messages1 → (1)

result in : ValidateResult

The validation result.

Emits validation messages.


public method Messages2 → (1)

messages in : IEnumerable<ValidateMessage>

The messages or null.

Emits validation messages.

Validate


public method Validate → (1)

validatable in : IValidatable

The object to validate. If null, no validation will be performed. If it implements the ICodeRange interface, it will be used as the context object (see BeginContext and End).

Convenience method that calls IValidatable.Validate on the given validatable in object passing this as argument.

Validate​Entry


public method ValidateEntry → (2)

name in : string

[not-empty]
The entry name.

validatable in : IValidatable

The object to validate. If null, no validation will be performed. If it implements the ICodeRange interface, it will be used as the context object (see BeginContext and End).

Convenience method that calls IValidatable.Validate on the given validatable in object passing this as argument, wrapping the call in BeginEntry and End.

Validate​Index


public method ValidateIndex → (2)

index in : int32

[>=0]
The element index.

validatable in : IValidatable

The object to validate. If null, no validation will be performed. If it implements the ICodeRange interface, it will be used as the context object (see BeginContext and End).

Convenience method that calls IValidatable.Validate on the given validatable in object passing this as argument, wrapping the call in BeginEntry and End.

Validate​Member


public method ValidateMember → (2)

name in : string

[not-empty]
The member name.

validatable in : IValidatable

The object to validate. If null, no validation will be performed. If it implements the ICodeRange interface, it will be used as the context object (see BeginContext and End).

Convenience method that calls IValidatable.Validate on the given validatable in object passing this as argument, wrapping the call in BeginEntry and End.

Validate​Member​List


public method ValidateMemberList → (2)
<T ref : IValidatable>

name in : string

[not-empty]
The member name.

validatableList in : IVectorConst<T>

The object list to validate. If null, no validation will be performed.

Convenience method that calls BeginMember and End for name in and in between ValidateIndex for each list element.

Public / Attributes

Count​Errors


public attribute CountErrors → (get)

value : int32

[>=0]
The number of error messages.

Returns the number of error messages.

The count can be used to detect if a call to IValidatable.Validate has emitted error messages.

Count​Messages


public attribute CountMessages → (get)

value : int32

[>=0]
The number of validation messages.

Returns the number of validation messages.

The count can be used to detect if a call to IValidatable.Validate has emitted any messages.

Count​Notices


public attribute CountNotices → (get)

value : int32

[>=0]
The number of notice messages.

Returns the number of notice messages.

The count can be used to detect if a call to IValidatable.Validate has emitted notice messages.

Count​Warnings


public attribute CountWarnings → (get)

value : int32

[>=0]
The number of warning messages.

Returns the number of warning messages.

The count can be used to detect if a call to IValidatable.Validate has emitted warning messages.

Has​Errors


public attribute HasErrors → (get)

value : bool

true if there is at least one error, false if not.

Have there been any errors during validation so far?

Has​Messages


public attribute HasMessages → (get)

value : bool

true if there is at least one error or warning, false if not.

Have there been any messages (errors / warnings / notices) during validation so far?

Has​Notices


public attribute HasNotices → (get)

value : bool

true if there is at least one notice, false if not.

Have there been any notices during validation so far?

Has​Warnings


public attribute HasWarnings → (get)

value : bool

true if there is at least one warning, false if not.

Have there been any warnings during validation so far?

Result


public attribute Result → (get)

value : ValidateResult

[not-null]
The validation result.

Returns the current validation result.