org.springframework.batch.repeat.callback
Class ItemReaderRepeatCallback

java.lang.Object
  extended by org.springframework.batch.repeat.callback.ItemReaderRepeatCallback
All Implemented Interfaces:
RepeatCallback

public class ItemReaderRepeatCallback
extends Object
implements RepeatCallback

Simple wrapper for two business interfaces: get the next item from a reader and apply the given writer to the result (if not null).

Author:
Dave Syer

Constructor Summary
ItemReaderRepeatCallback(ItemReader provider)
          Default writer is null, in which case we do nothing - subclasses can extend this behaviour, but must be careful to actually exhaust the provider by calling next().
ItemReaderRepeatCallback(ItemReader provider, ItemWriter writer)
           
 
Method Summary
 ExitStatus doInIteration(RepeatContext context)
          Use the writer to process the next item if there is one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemReaderRepeatCallback

public ItemReaderRepeatCallback(ItemReader provider,
                                ItemWriter writer)

ItemReaderRepeatCallback

public ItemReaderRepeatCallback(ItemReader provider)
Default writer is null, in which case we do nothing - subclasses can extend this behaviour, but must be careful to actually exhaust the provider by calling next().

Parameters:
provider -
Method Detail

doInIteration

public ExitStatus doInIteration(RepeatContext context)
                         throws Exception
Use the writer to process the next item if there is one. Return the item processed, or null if nothing was available.

Specified by:
doInIteration in interface RepeatCallback
Parameters:
context - the current context.
Returns:
null if the data provider is exhausted.
Throws:
Exception - if there is a problem with the processing.
See Also:
RepeatCallback.doInIteration(RepeatContext)


Copyright © 2009 SpringSource. All Rights Reserved.