Interface Row


public interface Row
Represents an immutable row of data in a CSV.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the row as a String.
    int
    Returns the number of values contained in the row.
    <T> T
    getValue(int index, CsvValueType<T> csvValueType)
    Retrieves a value at a column specified by its index.
    <T> T
    getValueByName(String columnName, CsvValueType<T> csvValueType)
    Retrieves a value at a column specified by its name.
  • Method Details

    • getValue

      <T> T getValue(int index, CsvValueType<T> csvValueType)
      Retrieves a value at a column specified by its index.

      If the value cannot be converted to the requested type, this throws an exception.

      Type Parameters:
      T - type of data requested
      Parameters:
      index - the column index. Cannot be negative or greater than/equal to the number of values.
      csvValueType - type of data requested. Cannot be null.
      Returns:
      the value at the specified index
    • getValueByName

      <T> T getValueByName(String columnName, CsvValueType<T> csvValueType)
      Retrieves a value at a column specified by its name.

      If the value cannot be converted to the requested type, this throws an exception.

      If the CSV this row belongs to does not have headers, this throws an exception.

      Type Parameters:
      T - type of data requested
      Parameters:
      columnName - the column name. Cannot be null or empty.
      csvValueType - type of data requested. Cannot be null.
      Returns:
      the value at the specified column
    • getSize

      int getSize()
      Returns the number of values contained in the row.
      Returns:
      the number of values contained in the row
    • asString

      String asString()
      Returns the row as a String.
      Returns:
      the row as a String