Class FunctionItemProcessor<I,O>

java.lang.Object
org.springframework.batch.item.function.FunctionItemProcessor<I,O>
All Implemented Interfaces:
ItemProcessor<I,O>

public class FunctionItemProcessor<I,O> extends Object implements ItemProcessor<I,O>
An ItemProcessor implementation that delegates to a Function
Since:
4.0
Author:
Michael Minella
  • Constructor Details

    • FunctionItemProcessor

      public FunctionItemProcessor(Function<I,O> function)
      Parameters:
      function - the delegate. Must not be null
  • Method Details

    • process

      @Nullable public O process(I item) throws Exception
      Description copied from interface: ItemProcessor
      Process the provided item, returning a potentially modified or new item for continued processing. If the returned result is null, it is assumed that processing of the item should not continue.

      A null item will never reach this method because the only possible sources are:

      • an ItemReader (which indicates no more items)
      • a previous ItemProcessor in a composite processor (which indicates a filtered item)
      Specified by:
      process in interface ItemProcessor<I,O>
      Parameters:
      item - to be processed, never null.
      Returns:
      potentially modified or new item for continued processing, null if processing of the provided item should not continue.
      Throws:
      Exception - thrown if exception occurs during processing.