BeanIO 2.0.4

org.beanio.internal.util
Interface StatefulWriter

All Known Implementing Classes:
BeanWriterImpl, XmlWriter

public interface StatefulWriter

StatefulWriter can be implemented by writers that maintain state, so that in case of an error, the last updated state of the writer can be restored and writing can resume.

This interface is used to implement a restartable flat file item writer for Spring Batch.

Since:
1.2
Author:
Kevin Seim

Method Summary
 void restoreState(String namespace, Map<String,Object> state)
          Restores a Map of previously stored state information.
 void updateState(String namespace, Map<String,Object> state)
          Updates a Map with the current state of the Writer to allow for restoration at a later time.
 

Method Detail

updateState

void updateState(String namespace,
                 Map<String,Object> state)
Updates a Map with the current state of the Writer to allow for restoration at a later time.

Parameters:
namespace - a String to prefix all state keys with
state - the Map to update with the latest state

restoreState

void restoreState(String namespace,
                  Map<String,Object> state)
                  throws IllegalStateException
Restores a Map of previously stored state information.

Parameters:
namespace - a String to prefix all state keys with
state - the Map containing the state to restore
Throws:
IllegalStateException - if the Map is missing any state information

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim