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 java.lang.Object
      implements ItemWriteListener<S>

  Author:
    Lucas Ward, Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeItemWriteListener()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterWrite(java.util.List<? extends S> items)` Call the registered listeners in reverse order, respecting and prioritising those that implement `Ordered`.
    `void` | `beforeWrite(java.util.List<? extends S> items)` Call the registered listeners in order, respecting and prioritising those that implement `Ordered`.
    `void` | `onWriteError(java.lang.Exception ex, java.util.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(java.util.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 Detail

    - #### CompositeItemWriteListener

          public CompositeItemWriteListener()

  - ### Method Detail

    - #### setListeners

          public void setListeners(java.util.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(java.util.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(java.util.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(java.lang.Exception ex,
                                   java.util.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)`