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

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

public class CsvTable
extends Object
implements CsvSerializer, CsvDeserializer

Represents a CSV table with multiple rows. If the table is initialized with a header, then the header will be the first row.


Constructor Summary
CsvTable()
          Creates a new CsvTable without a header
CsvTable(String... header)
          Creates a new CsvTable with the specified header.
 
Method Summary
 void addEntity(String[] descriptor)
          Add a single row to the CSV
 void addRow(String... row)
          Add a row to the table.
 Iterator<String[]> getEntities()
          Return an iterator over the rows of the CSV as a String[].
 List<String[]> getRows()
          Get the live list of rows contained in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvTable

public CsvTable()
Creates a new CsvTable without a header


CsvTable

public CsvTable(String... header)
Creates a new CsvTable with the specified header.

Parameters:
header - the header of the table
Method Detail

addRow

public void addRow(String... row)
Add a row to the table. This is a shortcut for getRows().add(row)

Parameters:
row - the row to add

getRows

public List<String[]> getRows()
Get the live list of rows contained in this table.

If the table contains a header, it will be the first element of the list.

Returns:
the live list of rows contained in this table

getEntities

public Iterator<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(String[] descriptor)
Description copied from interface: CsvDeserializer
Add a single row to the CSV

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


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