org.beanio.internal.util.StatefulWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beanio Show documentation
Show all versions of beanio Show documentation
A Java un/marshalling library for CSV, XML, delimited and fixed length stream formats.
package org.beanio.internal.util;
import java.util.Map;
/**
* 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.
*
* @author Kevin Seim
* @since 1.2
*/
public interface StatefulWriter {
/**
* Updates a Map with the current state of the Writer to allow for
* restoration at a later time.
* @param namespace a String to prefix all state keys with
* @param state the Map to update with the latest state
*/
public void updateState(String namespace, Map state);
/**
* Restores a Map of previously stored state information.
* @param namespace a String to prefix all state keys with
* @param state the Map containing the state to restore
* @throws IllegalStateException if the Map is missing any state information
*/
public void restoreState(String namespace, Map state) throws IllegalStateException;
}