org.springframework.batch.item.support
Class DelegatingItemWriter

java.lang.Object
  extended by org.springframework.batch.item.support.DelegatingItemWriter
All Implemented Interfaces:
ItemWriter, InitializingBean
Direct Known Subclasses:
ItemTransformerItemWriter

public class DelegatingItemWriter
extends Object
implements ItemWriter, InitializingBean

Simple wrapper around ItemWriter.

Author:
Dave Syer, Robert Kasanicky

Constructor Summary
DelegatingItemWriter()
          Default constructor.
DelegatingItemWriter(ItemWriter itemWriter)
           
 
Method Summary
 void afterPropertiesSet()
           
 void clear()
          Delegates to ItemWriter.clear()
protected  Object doProcess(Object item)
          By default returns the argument.
 void flush()
          Delegates to ItemWriter.flush()
 void setDelegate(ItemWriter writer)
          Setter for ItemWriter.
 void write(Object item)
          Calls doProcess(Object) and then writes the result to the delegate ItemWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingItemWriter

public DelegatingItemWriter()
Default constructor.


DelegatingItemWriter

public DelegatingItemWriter(ItemWriter itemWriter)
Parameters:
itemWriter -
Method Detail

write

public void write(Object item)
           throws Exception
Calls doProcess(Object) and then writes the result to the delegate ItemWriter.

Specified by:
write in interface ItemWriter
Throws:
Exception
See Also:
ItemWriter.write(Object)

doProcess

protected Object doProcess(Object item)
                    throws Exception
By default returns the argument. This method is an extension point meant to be overridden by subclasses that implement processing logic.

Throws:
Exception

setDelegate

public void setDelegate(ItemWriter writer)
Setter for ItemWriter.


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

clear

public void clear()
           throws ClearFailedException
Delegates to ItemWriter.clear()

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
Delegates to ItemWriter.flush()

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 © 2008 SpringSource. All Rights Reserved.