Class PredicateFilteringItemProcessor<T>
java.lang.Object
org.springframework.batch.item.function.PredicateFilteringItemProcessor<T>
- Type Parameters:
T- type of item to process
- All Implemented Interfaces:
ItemProcessor<T,T>
A filtering
ItemProcessor that is based on a Predicate. Items for which
the predicate returns true will be filtered.- Since:
- 5.2
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionPredicateFilteringItemProcessor(Predicate<T> predicate) Create a newPredicateFilteringItemProcessor. -
Method Summary
-
Constructor Details
-
PredicateFilteringItemProcessor
Create a newPredicateFilteringItemProcessor.- Parameters:
predicate- the predicate to use to filter items. Must not benull.
-
-
Method Details
-
process
Description copied from interface:ItemProcessorProcess the provided item, returning a potentially modified or new item for continued processing. If the returned result isnull, it is assumed that processing of the item should not continue.A
nullitem will never reach this method because the only possible sources are:- an
ItemReader(which indicates no more items) - a previous
ItemProcessorin a composite processor (which indicates a filtered item)
- Specified by:
processin interfaceItemProcessor<T,T> - Parameters:
item- to be processed, nevernull.- Returns:
- potentially modified or new item for continued processing,
nullif processing of the provided item should not continue. - Throws:
Exception- thrown if exception occurs during processing.
- an
-