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 anItemWriter
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 Description ItemWriterAdapter(javax.batch.api.chunk.ItemWriter writer)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.io.Serializable
doCheckpoint()
Used to provide aSerializable
representing the current state of the batch artifact.protected void
doClose()
Used to close the underlying batch artifactprotected 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
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 interfaceItemWriter<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 classCheckpointSupport
- 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 aSerializable
representing the current state of the batch artifact.- Specified by:
doCheckpoint
in classCheckpointSupport
- 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 classCheckpointSupport
- Throws:
java.lang.Exception
- thrown by the underlying implementation