org.springframework.batch.core

## Interface ItemProcessListener<T,S>

- All Superinterfaces:
    StepListener
  All Known Implementing Classes:
    CompositeItemProcessListener, DefaultItemFailureHandler, ItemListenerSupport, ItemProcessListenerAdapter, MulticasterBatchListener, StepListenerSupport

      public interface ItemProcessListener<T,S>
      extends StepListener

  Listener interface for the processing of an item. Implementations of this interface will be notified before and after an item is passed to the `ItemProcessor` and in the event of any exceptions thrown by the processor.
  Author:
    Dave Syer, Mahmoud Ben Hassine

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterProcess(T item, S result)` Called after `ItemProcessor.process(Object)` returns.
    `void` | `beforeProcess(T item)` Called before `ItemProcessor.process(Object)`.
    `void` | `onProcessError(T item, java.lang.Exception e)` Called if an exception was thrown from `ItemProcessor.process(Object)`.

- - ### Method Detail

    - #### beforeProcess

          void beforeProcess(T item)

      Called before `ItemProcessor.process(Object)`.
      Parameters:
        `item` - to be processed.

    - #### afterProcess

          void afterProcess(T item,
                            @Nullable
                            S result)

      Called after `ItemProcessor.process(Object)` returns. If the processor returns `null`, this method will still be called, with a {code null} result, allowing for notification of 'filtered' items.
      Parameters:
        `item` - to be processed
        `result` - of processing

    - #### onProcessError

          void onProcessError(T item,
                              java.lang.Exception e)

      Called if an exception was thrown from `ItemProcessor.process(Object)`.
      Parameters:
        `item` - attempted to be processed
        `e` - - exception thrown during processing.