org.springframework.batch.item.validator.ValidatingItemProcessor Java Examples
The following examples show how to use
org.springframework.batch.item.validator.ValidatingItemProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatingItemProcessorDemo.java From SpringAll with MIT License | 5 votes |
private ValidatingItemProcessor<TestData> validatingItemProcessor() { ValidatingItemProcessor<TestData> processor = new ValidatingItemProcessor<>(); processor.setValidator(value -> { // 对每一条数据进行校验 if ("".equals(value.getField3())) { // 如果field3的值为空串,则抛异常 throw new ValidationException("field3的值不合法"); } }); return processor; }