Package org.springframework.batch.core.listener

# Class CompositeItemWriteListener<S>

java.lang.Object
org.springframework.batch.core.listener.CompositeItemWriteListener<S>

All Implemented Interfaces:
  `ItemWriteListener<S>`, `StepListener`

public class CompositeItemWriteListener<S> extends Object implements ItemWriteListener<S>

Author:
  Lucas Ward, Dave Syer

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CompositeItemWriteListener()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterWrite(List<? extends S> items)`
  Call the registered listeners in reverse order, respecting and prioritising those that implement `Ordered`.
  `void`
  `beforeWrite(List<? extends S> items)`
  Call the registered listeners in order, respecting and prioritising those that implement `Ordered`.
  `void`
  `onWriteError(Exception ex, List<? extends S> items)`
  Call the registered listeners in reverse order, respecting and prioritising those that implement `Ordered`.
  `void`
  `register(ItemWriteListener<? super S> itemWriteListener)`
  Register additional listener.
  `void`
  `setListeners(List<? extends ItemWriteListener<? super S>> itemWriteListeners)`
  Public setter for the listeners.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CompositeItemWriteListener

    public CompositeItemWriteListener()

- ## Method Details

  - ### setListeners

    public void setListeners(List<? extends ItemWriteListener<? super S>> itemWriteListeners)
    Public setter for the listeners.
    Parameters:
      `itemWriteListeners` - list of `ItemWriteListener`s to be called when write events occur.

  - ### register

    public void register(ItemWriteListener<? super S> itemWriteListener)
    Register additional listener.
    Parameters:
      `itemWriteListener` - list of `ItemWriteListener`s to be registered.

  - ### afterWrite

    public void afterWrite(List<? extends S> items)
    Call the registered listeners in reverse order, respecting and prioritising those that implement `Ordered`.
    Specified by:
      `afterWrite` in interface `ItemWriteListener<S>`
    Parameters:
      `items` - written items
    See Also:
      - `ItemWriteListener.afterWrite(java.util.List)`

  - ### beforeWrite

    public void beforeWrite(List<? extends S> items)
    Call the registered listeners in order, respecting and prioritising those that implement `Ordered`.
    Specified by:
      `beforeWrite` in interface `ItemWriteListener<S>`
    Parameters:
      `items` - to be written
    See Also:
      - `ItemWriteListener.beforeWrite(List)`

  - ### onWriteError

    public void onWriteError(Exception ex, List<? extends S> items)
    Call the registered listeners in reverse order, respecting and prioritising those that implement `Ordered`.
    Specified by:
      `onWriteError` in interface `ItemWriteListener<S>`
    Parameters:
      `ex` - thrown from `ItemWriter`
      `items` - attempted to be written.
    See Also:
      - `ItemWriteListener.onWriteError(Exception, List)`