Package org.springframework.batch.core

# Interface ItemProcessListener<T,S>

All Superinterfaces:
  `StepListener`

All Known Implementing Classes:
  `CompositeItemProcessListener`, `DefaultItemFailureHandler`, `ItemListenerSupport`, `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

  Modifier and Type
  Method
  Description
  `default void`
  `afterProcess(T item, S result)`
  Called after `ItemProcessor.process(Object)` returns.
  `default void`
  `beforeProcess(T item)`
  Called before `ItemProcessor.process(Object)`.
  `default void`
  `onProcessError(T item, Exception e)`
  Called if an exception was thrown from `ItemProcessor.process(Object)`.

- ## Method Details

  - ### beforeProcess

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

  - ### afterProcess

    default 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

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