public class ItemListenerSupport<I,O> extends Object implements ItemReadListener<I>, ItemProcessListener<I,O>, ItemWriteListener<O>
ItemReadListener
,
ItemProcessListener
, and ItemWriteListener
interfaces. All
are implemented, since it is very common that all may need to be implemented
at once.Constructor and Description |
---|
ItemListenerSupport() |
Modifier and Type | Method and Description |
---|---|
void |
afterProcess(I item,
O result)
Called after
ItemProcessor.process(Object) returns. |
void |
afterRead(I item)
Called after
ItemReader.read() |
void |
afterWrite(List<? extends O> item)
Called after
ItemWriter.write(java.util.List) This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext) |
void |
beforeProcess(I item)
Called before
ItemProcessor.process(Object) . |
void |
beforeRead()
Called before
ItemReader.read() |
void |
beforeWrite(List<? extends O> item)
Called before
ItemWriter.write(java.util.List) |
void |
onProcessError(I item,
Exception e)
Called if an exception was thrown from
ItemProcessor.process(Object) . |
void |
onReadError(Exception ex)
Called if an error occurs while trying to read.
|
void |
onWriteError(Exception ex,
List<? extends O> item)
Called if an error occurs while trying to write.
|
public void afterRead(I item)
ItemReadListener
ItemReader.read()
afterRead
in interface ItemReadListener<I>
item
- returned from read()public void beforeRead()
ItemReadListener
ItemReader.read()
beforeRead
in interface ItemReadListener<I>
public void onReadError(Exception ex)
ItemReadListener
onReadError
in interface ItemReadListener<I>
ex
- thrown from ItemWriter
public void afterProcess(I item, O result)
ItemProcessListener
ItemProcessor.process(Object)
returns. If the
processor returns null, this method will still be called, with
a null result, allowing for notification of 'filtered' items.afterProcess
in interface ItemProcessListener<I,O>
item
- to be processedresult
- of processingpublic void beforeProcess(I item)
ItemProcessListener
ItemProcessor.process(Object)
.beforeProcess
in interface ItemProcessListener<I,O>
item
- to be processed.public void onProcessError(I item, Exception e)
ItemProcessListener
ItemProcessor.process(Object)
.onProcessError
in interface ItemProcessListener<I,O>
item
- attempted to be processede
- - exception thrown during processing.public void afterWrite(List<? extends O> item)
ItemWriteListener
ItemWriter.write(java.util.List)
This will be
called before any transaction is committed, and before
ChunkListener.afterChunk(ChunkContext)
afterWrite
in interface ItemWriteListener<O>
item
- written itemspublic void beforeWrite(List<? extends O> item)
ItemWriteListener
ItemWriter.write(java.util.List)
beforeWrite
in interface ItemWriteListener<O>
item
- to be writtenpublic void onWriteError(Exception ex, List<? extends O> item)
ItemWriteListener
onWriteError
in interface ItemWriteListener<O>
ex
- thrown from ItemWriter
item
- attempted to be written.Copyright © 2014 Pivotal. All rights reserved.