Interface BeanReader<T>

Type Parameters:
T - the bean class into which the rows are converted
All Known Implementing Classes:
BeanReaderImpl

public interface BeanReader<T>

The BeanReader is responsible for reading CSV rows and converting those into beans. There are two ways to initialize a BeanReaderImpl:

  • Point it to class. The org.csveed.annotations in the class are read, as is the order of the properties within the class.
  • Roll your own. Pass a BeanInstructions implementation with your own configuration settings
  • Method Summary

    Modifier and Type
    Method
    Description
    The set of instructions for dealing with beans.
    int
    Returns the line from which the bean was read.
    Returns the underlying line reader for the bean reader.
    boolean
    States whether the Reader is done with the file.
    Reads a single row and returns this as a bean.
    Reads all rows from the file and return these as beans.
    Returns the first readable line of the CSV file as header, regardless if useHeader==true.
  • Method Details

    • readBeans

      List<T> readBeans()
      Reads all rows from the file and return these as beans.
      Returns:
      all beans read from the Reader
    • readBean

      T readBean()
      Reads a single row and returns this as a bean. The RowReader will keep track of its state.
      Returns:
      Bean read from the Reader
    • readHeader

      Header readHeader()
      Returns the first readable line of the CSV file as header, regardless if useHeader==true.
      Returns:
      header
    • getCurrentLine

      int getCurrentLine()
      Returns the line from which the bean was read. Note that a line is seen as a legitimate CSV row, not necessarily a printable line (unless multi-lines are used, these values are the same).
      Returns:
      current line number
    • isFinished

      boolean isFinished()
      States whether the Reader is done with the file.
      Returns:
      true if file is finished
    • getRowReader

      RowReader getRowReader()
      Returns the underlying line reader for the bean reader.
      Returns:
      the underlying line reader
    • getBeanInstructions

      BeanInstructions getBeanInstructions()
      The set of instructions for dealing with beans.
      Returns:
      bean instructions