Validation

Initialization

To initialize a validator load a dictionary and create validators for different rules you need to check.

final IValidatorFactory validatorFactory = ValidatorFactory.createFactory(FIXVersion.FIX44, FIXVersion.FIX44);

final IValidatorContainer validators = validatorFactory.createRequiredValidator();

validators.putNewValidator(ValidatorType.MESSAGE_WELFORMED, validatorFactory.createValidator(ValidatorType.MESSAGE_WELFORMED));
validators.putNewValidator(ValidatorType.FIELD_ALLOWED, validatorFactory.createValidator(ValidatorType.FIELD_ALLOWED));
validators.putNewValidator(ValidatorType.REQUIRED_FIELDS, validatorFactory.createValidator(ValidatorType.REQUIRED_FIELDS));
validators.putNewValidator(ValidatorType.FIELD_ORDER, validatorFactory.createValidator(ValidatorType.FIELD_ORDER));
validators.putNewValidator(ValidatorType.DUPLICATE, validatorFactory.createValidator(ValidatorType.DUPLICATE));
validators.putNewValidator(ValidatorType.FIELD_DEFINITION, validatorFactory.createValidator(ValidatorType.FIELD_DEFINITION));
validators.putNewValidator(ValidatorType.CONDITIONAL, validatorFactory.createValidator(ValidatorType.CONDITIONAL));
validators.putNewValidator(ValidatorType.GROUP, validatorFactory.createValidator(ValidatorType.GROUP));

IMessageValidator validator = new ValidationEngine(validators);

Validation

To validate a message:

// get Fix message
final FIXFieldList fieldList = ...;
FIXErrorContainer errors = validator.validateFIXMessage(fieldList);

//print all errors
for (final FIXError error : errors.getAllFixErrors()) {
    System.out.println(error);
}

//print high error
System.out.println(errors.getIsPriorityFixError());
Generated on Wed Aug 22 17:11:17 2018 for FIXAntennaJava by  doxygen 1.6.3