Interface
caplin.trading.validation

Validator

A Validator is used to check data. It appends to the supplied caplin.trading.validation.ValidationResult object information about any errors found in the data. Multiple Validators may share a caplin.trading.validation.ValidationResult. If validation fails, errors should be added to the shared ValidationResult object. The ValidationResult object knows validation has failed if any errors have been added.

It is recommended that Validators do not have state. It is important that no Validator expects the caplin.trading.statemachine.StateMachine to change its state just because this Validator has passed as another Validator may have failed. The caplin.trading.statemachine.StateMachine will determine whether or not all validation has passed by calling caplin.trading.validation.ValidationResult#getValidationSuccessful on on the shared ValidationResult.

Constructor Summary

Attributes Name and Description
caplin.trading.validation.Validator()

The super constructor of implementors of Validator.

Method Summary

Attributes Name and Description
void validate(caplin.trading.trademodel.DataHolder oDataToValidate, caplin.trading.validation.ValidationResult oValidationResult)

Performs the validation on oDataToValidate according to rules in the class that implements the interface and appends information about errors found to oValidationResult.

Constructor Detail

caplin.trading.validation.Validator()

The super constructor of implementors of Validator.

Method Detail

void validate(caplin.trading.trademodel.DataHolder oDataToValidate, caplin.trading.validation.ValidationResult oValidationResult)

Performs the validation on oDataToValidate according to rules in the class that implements the interface and appends information about errors found to oValidationResult.

Parameters
caplin.trading.trademodel.DataHolder oDataToValidate The data to validate. Must not be null or undefined.
caplin.trading.validation.ValidationResult oValidationResult A caplin.trading.validation.ValidationResult to which information about validations is added. Must not be null or undefined.
Throws
caplin.core.Error
if there is something wrong with the data to validate or some other exception occurs during validation.