org.springframework.batch.core.jsr

## Class ItemReadListenerAdapter<T>

- java.lang.Object
- - org.springframework.batch.core.jsr.ItemReadListenerAdapter<T>

- Type Parameters:
    `T` - type to be returned via a read on the associated `ItemReader`
  All Implemented Interfaces:
    ItemReadListener<T>, StepListener

      public class ItemReadListenerAdapter<T>
      extends java.lang.Object
      implements ItemReadListener<T>

  Wrapper class to adapt the `ItemReadListener` to a `ItemReadListener`.
  Since:
    3.0
  Author:
    Michael Minella, Mahmoud Ben Hassine

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ItemReadListenerAdapter(javax.batch.api.chunk.listener.ItemReadListener delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterRead(T item)` Called after `ItemReader.read()`.
    `void` | `beforeRead()` Called before `ItemReader.read()`
    `void` | `onReadError(java.lang.Exception ex)` Called if an error occurs while trying to read.

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

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

- - ### Constructor Detail

    - #### ItemReadListenerAdapter

          public ItemReadListenerAdapter(javax.batch.api.chunk.listener.ItemReadListener delegate)

  - ### Method Detail

    - #### beforeRead

          public void beforeRead()

      Description copied from interface: `ItemReadListener`
      Called before `ItemReader.read()`
      Specified by:
        `beforeRead` in interface `ItemReadListener<T>`

    - #### afterRead

          public void afterRead(T item)

      Description copied from interface: `ItemReadListener`
      Called after `ItemReader.read()`. This method is called only for actual items (ie it is not called when the reader returns null).
      Specified by:
        `afterRead` in interface `ItemReadListener<T>`
      Parameters:
        `item` - returned from read()

    - #### onReadError

          public void onReadError(java.lang.Exception ex)

      Description copied from interface: `ItemReadListener`
      Called if an error occurs while trying to read.
      Specified by:
        `onReadError` in interface `ItemReadListener<T>`
      Parameters:
        `ex` - thrown from `ItemReader`