import ch.codeblock.qrinvoice.model.QrInvoice;
import ch.codeblock.qrinvoice.model.builder.QrInvoiceBuilder;
import ch.codeblock.qrinvoice.model.validation.QrInvoiceValidator;
import ch.codeblock.qrinvoice.model.validation.ValidationResult;
import java.util.List;
// ...
final QrInvoice qrInvoice = // create using QrInvoiceBuilder;
// now set some invalid data
// creditor must be set, this will result in a validation error
qrInvoice.getCreditorInformation().getCreditor().setName("");
// set an unsupported QR Type
qrInvoice.getHeader().setQrType("foo");
final ValidationResult validationResult = QrInvoiceValidator.create().validate(qrInvoice);
if(validationResult.hasErrors()) {
final String validationErrorSummary = validationResult.getValidationErrorSummary();
System.out.println(validationErrorSummary);
// access each ValidationError on its own
final List<ValidationResult.ValidationError> errors = validationResult.getErrors();
// ...
}