java.lang.Object
org.csveed.bean.BeanReaderImpl<T>
- Type Parameters:
T- the generic type
- All Implemented Interfaces:
BeanReader<T>
The Class BeanReaderImpl.
-
Constructor Summary
ConstructorsConstructorDescriptionBeanReaderImpl(Reader reader, Class<T> beanClass) Instantiates a new bean reader impl.BeanReaderImpl(Reader reader, BeanInstructions beanInstructions) Instantiates a new bean reader impl. -
Method Summary
Modifier and TypeMethodDescriptionCreates the mapping strategy.Gets the bean class.The set of instructions for dealing with beans.intReturns the line from which the bean was read.protected HeaderGets the header.Gets the mapper.Returns the underlying line reader for the bean reader.booleanStates whether the Reader is done with the file.protected voidLog settings.readBean()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.
-
Constructor Details
-
BeanReaderImpl
Instantiates a new bean reader impl.- Parameters:
reader- the readerbeanClass- the bean class
-
BeanReaderImpl
Instantiates a new bean reader impl.- Parameters:
reader- the readerbeanInstructions- the bean instructions
-
-
Method Details
-
getMapper
Gets the mapper.- Returns:
- the mapper
-
readBeans
Description copied from interface:BeanReaderReads all rows from the file and return these as beans.- Specified by:
readBeansin interfaceBeanReader<T>- Returns:
- all beans read from the Reader
-
readBean
Description copied from interface:BeanReaderReads a single row and returns this as a bean. The RowReader will keep track of its state.- Specified by:
readBeanin interfaceBeanReader<T>- Returns:
- Bean read from the Reader
-
logSettings
protected void logSettings()Log settings. -
getHeader
Gets the header.- Returns:
- the header
-
readHeader
Description copied from interface:BeanReaderReturns the first readable line of the CSV file as header, regardless if useHeader==true.- Specified by:
readHeaderin interfaceBeanReader<T>- Returns:
- header
-
getCurrentLine
public int getCurrentLine()Description copied from interface:BeanReaderReturns 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:
getCurrentLinein interfaceBeanReader<T>- Returns:
- current line number
-
isFinished
public boolean isFinished()Description copied from interface:BeanReaderStates whether the Reader is done with the file.- Specified by:
isFinishedin interfaceBeanReader<T>- Returns:
- true if file is finished
-
getRowReader
Description copied from interface:BeanReaderReturns the underlying line reader for the bean reader.- Specified by:
getRowReaderin interfaceBeanReader<T>- Returns:
- the underlying line reader
-
getBeanClass
Gets the bean class.- Returns:
- the bean class
-
createMappingStrategy
Creates the mapping strategy.- Returns:
- the abstract mapper
-
getBeanInstructions
Description copied from interface:BeanReaderThe set of instructions for dealing with beans.- Specified by:
getBeanInstructionsin interfaceBeanReader<T>- Returns:
- bean instructions
-