Skip to content

validators

Mahmoud Ben Hassine edited this page Feb 7, 2020 · 2 revisions

Validating input data is an essential step in every batch application. With Easy Batch, you can validate records by registering one or more RecordValidator implementation as follows:

Job job = new JobBuilder()
    .validator(new MyFirstRecordValidator())
    .processor(new MyRecordProcessor())
    .validator(new MySecondRecordValidator())
    .build();

Records will be rejected on first validation error.

The following table lists built-in validators and how to use them:

Validator Module Description
BeanValidationRecordValidator easy-batch-validation uses the Bean Validation API to validate domain objects
XmlRecordValidator easy-batch-xml uses JAXB to validate domain objects against an XML schema
Clone this wiki locally