java.lang.Object
org.csveed.bean.BeanReaderImpl<T>
- Type Parameters:
T
- the generic type
- All Implemented Interfaces:
BeanReader<T>
The Class BeanReaderImpl.
-
Constructor Summary
ConstructorDescriptionBeanReaderImpl
(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.int
Returns the line from which the bean was read.protected Header
Gets the header.Gets the mapper.Returns the underlying line reader for the bean reader.boolean
States whether the Reader is done with the file.protected void
Log 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
-
BeanReaderImpl
Instantiates a new bean reader impl.- Parameters:
reader
- the readerbeanInstructions
- the bean instructions
-
-
Method Details
-
getMapper
-
readBeans
Description copied from interface:BeanReader
Reads all rows from the file and return these as beans.- Specified by:
readBeans
in interfaceBeanReader<T>
- Returns:
- all beans read from the Reader
-
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 interfaceBeanReader<T>
- Returns:
- Bean read from the Reader
-
logSettings
protected void logSettings()Log settings. -
getHeader
-
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 interfaceBeanReader<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 interfaceBeanReader<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 interfaceBeanReader<T>
- Returns:
- true if file is finished
-
getRowReader
Description copied from interface:BeanReader
Returns the underlying line reader for the bean reader.- Specified by:
getRowReader
in interfaceBeanReader<T>
- Returns:
- the underlying line reader
-
getBeanClass
-
createMappingStrategy
Creates the mapping strategy.- Returns:
- the abstract mapper
-
getBeanInstructions
Description copied from interface:BeanReader
The set of instructions for dealing with beans.- Specified by:
getBeanInstructions
in interfaceBeanReader<T>
- Returns:
- bean instructions
-