org.springframework.batch.core.listener
Class ItemListenerSupport

java.lang.Object
  extended by org.springframework.batch.core.listener.ItemListenerSupport
All Implemented Interfaces:
ItemReadListener, ItemWriteListener, StepListener
Direct Known Subclasses:
DefaultItemFailureHandler

public class ItemListenerSupport
extends Object
implements ItemWriteListener, ItemReadListener

Basic no-op implementation of both the ItemWriteListener and ItemReadListener interfaces. Both are implemented, since it is very common that both may need to be implemented at once.

Author:
Lucas Ward

Constructor Summary
ItemListenerSupport()
           
 
Method Summary
 void afterRead(Object item)
          Called after ItemReader.read()
 void afterWrite(Object item)
          Called after ItemWriter.write(Object) If the item is last in a chunk, this will be called before any transaction is committed, and before ChunkListener.afterChunk()
 void beforeRead()
          Called before ItemReader.read()
 void beforeWrite(Object item)
          Called before ItemWriter.write(Object)
 void onReadError(Exception ex)
          Called if an error occurs while trying to write.
 void onWriteError(Exception ex, Object item)
          Called if an error occurs while trying to write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemListenerSupport

public ItemListenerSupport()
Method Detail

afterWrite

public void afterWrite(Object item)
Description copied from interface: ItemWriteListener
Called after ItemWriter.write(Object) If the item is last in a chunk, this will be called before any transaction is committed, and before ChunkListener.afterChunk()

Specified by:
afterWrite in interface ItemWriteListener
Parameters:
item - written item

beforeWrite

public void beforeWrite(Object item)
Description copied from interface: ItemWriteListener
Called before ItemWriter.write(Object)

Specified by:
beforeWrite in interface ItemWriteListener
Parameters:
item - to be written

onWriteError

public void onWriteError(Exception ex,
                         Object item)
Description copied from interface: ItemWriteListener
Called if an error occurs while trying to write.

Specified by:
onWriteError in interface ItemWriteListener
Parameters:
ex - thrown from ItemWriter
item - attempted to be written.

afterRead

public void afterRead(Object item)
Description copied from interface: ItemReadListener
Called after ItemReader.read()

Specified by:
afterRead in interface ItemReadListener
Parameters:
item - returned from read()

beforeRead

public void beforeRead()
Description copied from interface: ItemReadListener
Called before ItemReader.read()

Specified by:
beforeRead in interface ItemReadListener

onReadError

public void onReadError(Exception ex)
Description copied from interface: ItemReadListener
Called if an error occurs while trying to write.

Specified by:
onReadError in interface ItemReadListener
Parameters:
ex - thrown from ItemWriter


Copyright © 2008 SpringSource. All Rights Reserved.