@@ -0,0 +1,1248 @@
+package net.benas.cb4j.tutorials;%0D%0A%0D%0Aimport net.benas.cb4j.core.api.FieldValidator;%0D%0Aimport net.benas.cb4j.core.impl.RecordValidatorImpl;%0D%0Aimport net.benas.cb4j.core.model.Record;%0D%0A%0D%0Aimport java.util.List;%0D%0Aimport java.util.Map;%0D%0A%0D%0A/**%0D%0A * A custom validator to implement validation rule that involve multiple fields at the same time%0D%0A * @author benas (md.benhassine@gmail.com)%0D%0A */%0D%0Apublic class MyCustomRecordValidator extends RecordValidatorImpl %7B%0D%0A%0D%0A    public MyCustomRecordValidator(Map%3CInteger, List%3CFieldValidator%3E%3E fieldValidators) %7B%0D%0A        super(fieldValidators);%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public String validateRecord(Record record) %7B%0D%0A%0D%0A        String error = super.validateRecord(record);%0D%0A        if (error.isEmpty())%7B//no errors after applying declared validators on each field =%3E all fields are valid%0D%0A%0D%0A            //add custom validation : field 2 content must starts with field 1 content%0D%0A            final String content1 = record.getContentByIndex(1);%0D%0A            final String content2 = record.getContentByIndex(2);%0D%0A            if (!content2.startsWith(content1))%0D%0A                return %22field 2 content %5B%22 + content2 + %22%5D must start with field 1 content %5B%22 + content1 + %22%5D%22;%0D%0A        %7D%0D%0A        return %22%22;%0D%0A    %7D%0D%0A%7D%0D%0A

add custom validator sample