org.springframework.batch.jsr.item

## Class ItemWriterAdapter<T>

- java.lang.Object
- - org.springframework.batch.item.ItemStreamSupport
  - - org.springframework.batch.jsr.item.CheckpointSupport
    - - org.springframework.batch.jsr.item.ItemWriterAdapter<T>

- All Implemented Interfaces:
    ItemStream, ItemWriter<T>

      public class ItemWriterAdapter<T>
      extends CheckpointSupport
      implements ItemWriter<T>

  Adapter that wraps an `ItemWriter` for use by Spring Batch. All calls are delegated as appropriate to the corresponding method on the delegate.
  Since:
    3.0
  Author:
    Michael Minella

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ItemWriterAdapter(javax.batch.api.chunk.ItemWriter writer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.io.Serializable` | `doCheckpoint()` Used to provide a `Serializable` representing the current state of the batch artifact.
    `protected void` | `doClose()` Used to close the underlying batch artifact
    `protected void` | `doOpen(java.io.Serializable checkpoint)` Used to open a batch artifact with previously saved checkpoint information.
    `void` | `write(java.util.List<? extends T> items)` Process the supplied data element.

    - ### Methods inherited from class org.springframework.batch.jsr.item.CheckpointSupport

      `close, open, update`

    - ### Methods inherited from class org.springframework.batch.item.ItemStreamSupport

      `getExecutionContextKey, setExecutionContextName, setName`

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

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

- - ### Constructor Detail

    - #### ItemWriterAdapter

          public ItemWriterAdapter(javax.batch.api.chunk.ItemWriter writer)

      Parameters:
        `writer` - a `ItemWriter` to delegate calls to

  - ### Method Detail

    - #### write

          public void write(java.util.List<? extends T> items)
                     throws java.lang.Exception

      Description copied from interface: `ItemWriter`
      Process the supplied data element. Will not be called with any null items in normal operation.
      Specified by:
        `write` in interface `ItemWriter<T>`
      Parameters:
        `items` - items to be written
      Throws:
        `java.lang.Exception` - if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.

    - #### doOpen

          protected void doOpen(java.io.Serializable checkpoint)
                         throws java.lang.Exception

      Description copied from class: `CheckpointSupport`
      Used to open a batch artifact with previously saved checkpoint information.
      Specified by:
        `doOpen` in class `CheckpointSupport`
      Parameters:
        `checkpoint` - previously saved checkpoint object
      Throws:
        `java.lang.Exception` - thrown by the implementation

    - #### doCheckpoint

          protected java.io.Serializable doCheckpoint()
                                               throws java.lang.Exception

      Description copied from class: `CheckpointSupport`
      Used to provide a `Serializable` representing the current state of the batch artifact.
      Specified by:
        `doCheckpoint` in class `CheckpointSupport`
      Returns:
        the current state of the batch artifact
      Throws:
        `java.lang.Exception` - thrown by the implementation

    - #### doClose

          protected void doClose()
                          throws java.lang.Exception

      Description copied from class: `CheckpointSupport`
      Used to close the underlying batch artifact
      Specified by:
        `doClose` in class `CheckpointSupport`
      Throws:
        `java.lang.Exception` - thrown by the underlying implementation