Class DataRow

java.lang.Object
org.fastnate.data.csv.properties.DataRow

public abstract class DataRow extends Object
A row from an import file. Especially useful in CSV and table calculation files. Don't keep a reference to this row in consumers, as it may be reused across different rows.
Author:
Tobias Liefke
  • Constructor Details

    • DataRow

      public DataRow(List<String> columnNames)
      Creates a new instance of a container for row data.
      Parameters:
      columnNames - the header row with the column names
  • Method Details

    • getColumnCount

      public int getColumnCount()
      The count of columns (according to the header).
      Returns:
      the count of columns available
    • getName

      public String getName(int columnIndex)
      The name of column at the given index.
      Parameters:
      columnIndex - the index of the column
      Returns:
      the name of the column or the empty string ("") if no column exists at the given index
    • getValue

      public abstract String getValue(int columnIndex)
      Reads the value of the column at the given index.
      Parameters:
      columnIndex - the index of the column
      Returns:
      the value in that column or the empty string (""), if the column is empty or does not exist
    • getValue

      public String getValue(String columnName)
      Reads the value of the column with the given name.
      Parameters:
      columnName - the name of the column.
      Returns:
      the value in that column or the empty string (""), if the column is empty or does not exist