org.apache.wink.common.model.csv
Class MultiCsvTable

java.lang.Object
  extended by org.apache.wink.common.model.csv.MultiCsvTable
All Implemented Interfaces:
CsvDeserializer, CsvSerializer

public class MultiCsvTable
extends java.lang.Object
implements CsvSerializer, CsvDeserializer

Represents a multiple table CSV. Contains multiple (separate) tables that make up a single CSV. The rows of the tables may be of different lengths. An empty line is used to separate the tables when serializing or deserializing.


Constructor Summary
MultiCsvTable()
           
 
Method Summary
 void addEntity(java.lang.String[] row)
          Add a row to the last table when deserializing a multi table csv.
 void addTable(CsvTable table)
          Add a table to this multi-table csv.
 CsvTable createCsvTable(java.lang.String... header)
          Create a new CsvTable with the specified header, and add it to this multi-table csv
 java.util.Iterator<java.lang.String[]> getEntities()
          Return an iterator over the rows of the CSV as a String[].
 java.util.List<CsvTable> getTables()
          Get the live list of tables contained in this multi-table csv
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiCsvTable

public MultiCsvTable()
Method Detail

createCsvTable

public CsvTable createCsvTable(java.lang.String... header)
Create a new CsvTable with the specified header, and add it to this multi-table csv

Parameters:
header - the header of the new table (can be empty).
Returns:
the created table

addTable

public void addTable(CsvTable table)
Add a table to this multi-table csv. This is a shortcut for getTables().add(table)

Parameters:
table - the table to add

getTables

public java.util.List<CsvTable> getTables()
Get the live list of tables contained in this multi-table csv

Returns:
the live list of tables contained in this multi-table csv

getEntities

public java.util.Iterator<java.lang.String[]> getEntities()
Description copied from interface: CsvSerializer
Return an iterator over the rows of the CSV as a String[].

Specified by:
getEntities in interface CsvSerializer
Returns:
Iterator iterator over the rows

addEntity

public void addEntity(java.lang.String[] row)
Add a row to the last table when deserializing a multi table csv.

If no table exists, or the length of the row is 0, or the row has only one element and it is null or an empty string, then a new table is created instead of adding the row to the last table.

Specified by:
addEntity in interface CsvDeserializer
Parameters:
row - the row to add


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.