Dec 29th, 2011, 06:01 AM
ItemProcessor receiving one item returning more than one
I have a question regarding ItemProcessor, I need to transform an input element into different elements according to what is stored in a mapping table.
The mapping table contains a simple mapping logic:
A --> 1
A --> 2
B --> 1
B --> 3
So in case the ItemReader receives an "A" element, two different elements have to be returned from ItemProcessor: "1" and "2" and therefore two elements will be passed to ItemWritter (1 and 2).
I think that the best place to include the mapping logic is an ItemProcessor, but I do not know if it is even possible, as I should return a List element from the "process" method.
Should this logic be included in the ItemProcessor? Or if it is not possible (returning more than one element from the ItemProcessor) it has to be included directly in the ItemWritter?
Thanks a lot and best regards.
Tags for this Thread