validateSegments(structure, validatorFactory);
validateSegmentFields(structure, validatorFactory);
}
private void validateSegments(ComplexTextStructure structure, TextValidatorFactory validatorFactory) {
TextStructureValidator validator = validatorFactory.createSegmentValidator(structure);
for (ValidationIssue issue : validator.validate()) {
fatal(issue.getDescription());
}
}