com.ricebridge.csvman
Class AsListsLineProvider

java.lang.Object
  extended bycom.ricebridge.csvman.LineProviderSupportImpl
      extended bycom.ricebridge.csvman.CustomLineProvider
          extended bycom.ricebridge.csvman.AsListsLineProvider
All Implemented Interfaces:
LineProvider

public class AsListsLineProvider
extends CustomLineProvider

Simple implementation of LineProvider that provides data lines for saving from a List of Lists of Strings.

The easiest way to save your CSV data in this format is to use the CsvManager.saveAsLists method.

AsListsLineProvider is designed to be subclassed. You can change the default implementation by calling the CsvManagerStore.setAsListsLineProviderClass method, and providing a subclass of AsListsLineProvider. CsvManagerStore can be accessed using CsvManager.getCsvManagerStore().

The Source Code of this Java class is available under a BSD-style license.

See Also:
LineProvider, CustomLineProvider, BasicLineProvider, ResultSetLineProvider, TableModelLineProvider, BeanLineProvider

Field Summary
protected  List iData
          List of Lists of Strings.
protected  long iLineIndex
          Index of current line in List.
 
Constructor Summary
AsListsLineProvider()
          Create uninitialised for use with setData.
AsListsLineProvider(List pData)
          Create with data lines as List of Lists of Strings.
 
Method Summary
 boolean hasNextLineImpl()
          Return true if line index is less than number of data lines in list.
protected  String makeLineDescription(Object pLine)
          Description of data line for error messages.
 String[] nextLineImpl()
          Return next data line from list.
 void setData(List pData)
          Set data lines to save as List of Lists of Strings.
 void startProcessImpl()
          Handle start of saving process by reseting line index.
 
Methods inherited from class com.ricebridge.csvman.CustomLineProvider
endProcessImpl, setCsvSpecImpl, setLineSpecImpl
 
Methods inherited from class com.ricebridge.csvman.LineProviderSupportImpl
endProcess, hasNextLine, nextLine, setCsvSpec, setLineSpec, startProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iData

protected List iData
List of Lists of Strings.


iLineIndex

protected long iLineIndex
Index of current line in List.

Constructor Detail

AsListsLineProvider

public AsListsLineProvider()
Create uninitialised for use with setData.


AsListsLineProvider

public AsListsLineProvider(List pData)
Create with data lines as List of Lists of Strings.

Parameters:
pData - list of lines
Method Detail

startProcessImpl

public void startProcessImpl()
                      throws Exception
Handle start of saving process by reseting line index.

Overrides:
startProcessImpl in class CustomLineProvider
Throws:
Exception
See Also:
endProcessImpl

hasNextLineImpl

public boolean hasNextLineImpl()
                        throws Exception
Return true if line index is less than number of data lines in list.

Specified by:
hasNextLineImpl in class CustomLineProvider
Throws:
Exception
See Also:
LineProvider.hasNextLine, nextLineImpl

nextLineImpl

public String[] nextLineImpl()
                      throws Exception
Return next data line from list.

Specified by:
nextLineImpl in class CustomLineProvider
Throws:
Exception
See Also:
LineProvider.nextLine, hasNextLineImpl

setData

public void setData(List pData)
Set data lines to save as List of Lists of Strings.


makeLineDescription

protected String makeLineDescription(Object pLine)
Description of data line for error messages.



Copyright © 2003-2006 Ricebridge