org.springframework.batch.item.adapter
Class ItemReaderAdapter

java.lang.Object
  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.

Author:
Robert Kasanicky

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

ItemReaderAdapter

public ItemReaderAdapter()
Method Detail

read

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
Returns:
return value of the target method.
Throws:
Exception - if an underlying resource is unavailable.

mark

public void mark()
          throws MarkFailedException
No-op.

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

reset

public void reset()
           throws ResetFailedException
No-op.

Specified by:
reset in interface ItemReader
Throws:
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 © 2009 SpringSource. All Rights Reserved.