Caplin Trader 4.7.1

Class: module:caplin/trading/validation/ValidationResult

module:caplin/trading/validation/ValidationResult

Constructor

new module:caplin/trading/validation/ValidationResult()

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:caplin/trading/validation/Validators 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:caplin/trading/validation/Validator does with the errors in a ValidationResult, it will return true from module:caplin/trading/validation/ValidationResult#getValidationSuccessful if the validation succeeded and false otherwise.
A single ValidationResult may have validation information added to many module:caplin/trading/validation/Validators.

Methods

addError(oErrorObj)

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.
See:

fail()

Sets the validation status to unsuccessful. A subsequent call to getValidationSuccessful will return false.
See:

getErrors() → {Array}

Returns the list of errors.
Returns:
Returns the errors for all validations so far. The default is an empty array.
Type
Array

getValidationSuccessful() → {boolean}

Returns true if the validation was successful, or false otherwise.
Returns:
True if the validation was successful.
Type
boolean