Class 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 
      ConstructorDescription
      ItemWriterAdapter​(javax.batch.api.chunk.ItemWriter writer) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      protected java.io.SerializabledoCheckpoint()
      Used to provide a Serializable representing the current state of the batch artifact.
      protected voiddoClose()
      Used to close the underlying batch artifact
      protected voiddoOpen​(java.io.Serializable checkpoint)
      Used to open a batch artifact with previously saved checkpoint information.
      voidwrite​(java.util.List<? extends T> items)
      Process the supplied data element.
      • 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