new module:ct-trading /validation /Validation Result()
The constructor for ValidationResults. When a ValidationResult is constructed, it's status is successful; that is, an immediate call to getValidationSuccessful() will return true.
Contains the result of validation by module:ct-trading/validation/Validator
s including any errors.
This structure of the errors is transparent to this class. The error structure is defined by the validator that utilises a ValidationResult instance.
No matter what the module:ct-trading/validation/Validator
does with the errors in a ValidationResult, it will return true from module:ct-trading/validation/ValidationResult#getValidationSuccessful
if the validation succeeded and false otherwise.
A single ValidationResult may have validation information added to many module:ct-trading/validation/Validator
s.
Methods
add Error(oError Obj)
Adds an error to this ValidationResult. If an error is added, a subsequent call to getValidationSuccessful will return false.
Parameters:
Name | Type | Description |
---|---|---|
oErrorObj |
Object | is an object containing any error that occurred during validation. |
fail()
Sets the validation status to unsuccessful. A subsequent call to getValidationSuccessful will return false.
get Errors() → {Array}
Returns the list of errors.
Returns:
Returns the errors for all validations so far. The default is an empty array.
- Type
- Array
get Validation Successful() → {boolean}
Returns true if the validation was successful, or false otherwise.
Returns:
True if the validation was successful.
- Type
- boolean