org.springframework.batch.item.adapter
Class ItemWriterAdapter

java.lang.Object
  extended by org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
      extended by org.springframework.batch.item.adapter.ItemWriterAdapter
All Implemented Interfaces:
ItemWriter, InitializingBean

public class ItemWriterAdapter
extends AbstractMethodInvokingDelegator
implements ItemWriter

Delegates item processing to a custom method - passes the item as an argument for the delegate method.

Author:
Robert Kasanicky
See Also:
PropertyExtractingDelegatingItemWriter

Constructor Summary
ItemWriterAdapter()
           
 
Method Summary
 void clear()
          Clear any buffers that are being held.
 void flush()
          Flush any buffers that are being held.
 void write(Object item)
          Process the supplied data element.
 
Methods inherited from class org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
afterPropertiesSet, invokeDelegateMethod, invokeDelegateMethodWithArgument, invokeDelegateMethodWithArguments, setArguments, setTargetMethod, setTargetObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemWriterAdapter

public ItemWriterAdapter()
Method Detail

write

public void write(Object item)
           throws Exception
Description copied from interface: ItemWriter
Process the supplied data element. Will be called multiple times during a larger batch operation. Will not be called with null data in normal operation.

Specified by:
write in interface ItemWriter
Throws:
Exception - if there are errors. If the writer is used inside a retry or a batch the framework will catch the exception and convert or rethrow it as appropriate.

clear

public void clear()
           throws ClearFailedException
Description copied from interface: ItemWriter
Clear any buffers that are being held. This will usually be performed prior to rolling back any transactions.

Specified by:
clear in interface ItemWriter
Throws:
ClearFailedException - in case of an error. If this exception is thrown the writer may be in an inconsistent state and manual intervention might be required to reconcile the data with persistent output.

flush

public void flush()
           throws FlushFailedException
Description copied from interface: ItemWriter
Flush any buffers that are being held. This will usually be performed prior to committing any transactions.

Specified by:
flush in interface ItemWriter
Throws:
FlushFailedException - in case of an error. If this exception is thrown the writer may be in an inconsistent state and manual intervention might be required to reconcile the data with persistent output.


Copyright © 2009 SpringSource. All Rights Reserved.