ObjectValidator - Andrei15193/react-model-view-viewmodel GitHub Wiki
API / ObjectValidator<TValidatable, TValidationError> class
Represents a base implementation for an object validator.
Implements IObjectValidator<TValidatable, TValidationError>.
class ObjectValidator<TValidatable extends IValidatable<TValidationError> | INotifyPropertiesChanged, TValidationError = string>
implements IObjectValidator<TValidatable, TValidationError>
Source reference: src/validation/objectValidator/ObjectValidator.ts:25
.
-
TValidatable - The instance type that is being validated.
Type constraints: IValidatable<TValidationError> & INotifyPropertiesChanged.
-
TValidationError - The concrete type for representing validation errors (strings, enums, numbers etc.).
Default value:
string
.
-
constructor - Initializes a new instance of the
ObjectValidator<TValidatable, TValidationError>
class.
-
readonly
target - Gets the object that is being validated. -
readonly
triggers - Gets the validation triggers that have been configured. -
readonly
validators - Gets the validators that have been configured.
- add - Configures the given validators and validates the target afterwards.
-
reset - Resets the validator configuraiton, removes all triggers and validators and sets the error on the target to
null
. - validate - Validates the target using the currently configured validators. Validation does get triggered when the
- ObjectValidator<TValidatable, TValidationError>