|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.validator.ValidatingItemProcessor<T>
public class ValidatingItemProcessor<T>
Simple implementation of ItemProcessor
that validates input and
returns it without modifications. Should the given Validator
throw a
ValidationException
this processor will re-throw it to indicate the
item should be skipped, unless setFilter(boolean)
is set to
true
, in which case null
will be returned to
indicate the item should be filtered.
Constructor Summary | |
---|---|
ValidatingItemProcessor()
Default constructor |
|
ValidatingItemProcessor(Validator<? super T> validator)
Creates a ValidatingItemProcessor based on the given Validator. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
T |
process(T item)
Validate the item and return it unmodified |
void |
setFilter(boolean filter)
Should the processor filter invalid records instead of skipping them? |
void |
setValidator(Validator<? super T> validator)
Set the validator used to validate each item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidatingItemProcessor()
public ValidatingItemProcessor(Validator<? super T> validator)
Method Detail |
---|
public void setValidator(Validator<? super T> validator)
validator
- public void setFilter(boolean filter)
filter
- public T process(T item) throws ValidationException
process
in interface ItemProcessor<T,T>
item
- to be processed
ValidationException
- if validation failspublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |