Class ItemReaderAdapter

  extended by org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator
      extended by org.springframework.batch.item.adapter.ItemReaderAdapter
All Implemented Interfaces:
ItemReader, InitializingBean

public class ItemReaderAdapter
extends AbstractMethodInvokingDelegator
implements ItemReader

Invokes a custom method on a delegate plain old Java object which itself provides an item.

Robert Kasanicky

Constructor Summary
Method Summary
 void mark()
 Object read()
          Reads a piece of input data and advance to the next one.
 void reset()
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


public ItemReaderAdapter()
Method Detail


public Object read()
            throws Exception
Description copied from interface: ItemReader
Reads a piece of input data and advance to the next one. Implementations must return null at the end of the input data set. In a transactional setting, caller might get the same item twice from successive calls (or otherwise), if the first call was in a transaction that rolled back.

Specified by:
read in interface ItemReader
return value of the target method.
Exception - if an underlying resource is unavailable.


public void mark()
          throws MarkFailedException

Specified by:
mark in interface ItemReader
MarkFailedException - if there is a problem with the mark. If a mark fails inside a transaction, it would be worrying, but not normally fatal.


public void reset()
           throws ResetFailedException

Specified by:
reset in interface ItemReader
ResetFailedException - if there is a problem with the reset. If a reset fails inside a transaction, it would normally be fatal, and would leave the stream in an inconsistent state. So while this is an unchecked exception, it may be important for a client to catch it explicitly.

Copyright © 2008 SpringSource. All Rights Reserved.