Class BeanReaderImpl<T>

java.lang.Object
org.csveed.bean.BeanReaderImpl<T>
Type Parameters:
T - the generic type
All Implemented Interfaces:
BeanReader<T>

public class BeanReaderImpl<T> extends Object implements BeanReader<T>
The Class BeanReaderImpl.
  • Constructor Details

    • BeanReaderImpl

      public BeanReaderImpl(Reader reader, Class<T> beanClass)
      Instantiates a new bean reader impl.
      Parameters:
      reader - the reader
      beanClass - the bean class
    • BeanReaderImpl

      public BeanReaderImpl(Reader reader, BeanInstructions beanInstructions)
      Instantiates a new bean reader impl.
      Parameters:
      reader - the reader
      beanInstructions - the bean instructions
  • Method Details

    • getMapper

      public AbstractMapper<T> getMapper()
      Gets the mapper.
      Returns:
      the mapper
    • readBeans

      public List<T> readBeans()
      Description copied from interface: BeanReader
      Reads all rows from the file and return these as beans.
      Specified by:
      readBeans in interface BeanReader<T>
      Returns:
      all beans read from the Reader
    • readBean

      public T readBean()
      Description copied from interface: BeanReader
      Reads a single row and returns this as a bean. The RowReader will keep track of its state.
      Specified by:
      readBean in interface BeanReader<T>
      Returns:
      Bean read from the Reader
    • logSettings

      protected void logSettings()
      Log settings.
    • getHeader

      protected Header getHeader()
      Gets the header.
      Returns:
      the header
    • readHeader

      public Header readHeader()
      Description copied from interface: BeanReader
      Returns the first readable line of the CSV file as header, regardless if useHeader==true.
      Specified by:
      readHeader in interface BeanReader<T>
      Returns:
      header
    • getCurrentLine

      public int getCurrentLine()
      Description copied from interface: BeanReader
      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).
      Specified by:
      getCurrentLine in interface BeanReader<T>
      Returns:
      current line number
    • isFinished

      public boolean isFinished()
      Description copied from interface: BeanReader
      States whether the Reader is done with the file.
      Specified by:
      isFinished in interface BeanReader<T>
      Returns:
      true if file is finished
    • getRowReader

      public RowReader getRowReader()
      Description copied from interface: BeanReader
      Returns the underlying line reader for the bean reader.
      Specified by:
      getRowReader in interface BeanReader<T>
      Returns:
      the underlying line reader
    • getBeanClass

      public Class<T> getBeanClass()
      Gets the bean class.
      Returns:
      the bean class
    • createMappingStrategy

      public AbstractMapper<T> createMappingStrategy()
      Creates the mapping strategy.
      Returns:
      the abstract mapper
    • getBeanInstructions

      public BeanInstructions getBeanInstructions()
      Description copied from interface: BeanReader
      The set of instructions for dealing with beans.
      Specified by:
      getBeanInstructions in interface BeanReader<T>
      Returns:
      bean instructions