Interface ColumnReader<T>
- Type Parameters:
T
- the type of the data stored by the columns.
- All Known Subinterfaces:
BatchedColumnReader<T>
- All Known Implementing Classes:
AbstractBatchedColumnProcessor
,AbstractBatchedObjectColumnProcessor
,AbstractColumnProcessor
,AbstractObjectColumnProcessor
,BatchedColumnProcessor
,BatchedObjectColumnProcessor
,ColumnProcessor
,ObjectColumnProcessor
interface ColumnReader<T>
A common interface for
Processor
s that collect the values parsed from each column in a row.
Namely: AbstractColumnProcessor
, AbstractObjectColumnProcessor
, AbstractBatchedColumnProcessor
and AbstractBatchedObjectColumnProcessor
.-
Method Summary
Modifier and TypeMethodDescriptiongetColumn
(int columnIndex) Returns the values of a given column.Returns the values of a given column.Returns the values processed for each columnReturns a map of column indexes and their respective list of values parsed from the input.Returns a map of column names and their respective list of values parsed from the input.String[]
Returns the column headers.void
putColumnValuesInMapOfIndexes
(Map<Integer, List<T>> map) Fills a given map associating each column index to its list of valuesvoid
putColumnValuesInMapOfNames
(Map<String, List<T>> map) Fills a given map associating each column name to its list o values
-
Method Details
-
getHeaders
String[] getHeaders()Returns the column headers. This can be either the headers defined inCommonSettings.getHeaders()
or the headers parsed in the input whenCommonSettings.getHeaders()
equals totrue
- Returns:
- the headers of all column parsed.
-
getColumnValuesAsList
Returns the values processed for each column- Returns:
- a list of lists. The stored lists correspond to the position of the column processed from the input; Each list contains the corresponding values parsed for a column, across multiple rows.
-
putColumnValuesInMapOfNames
Fills a given map associating each column name to its list o values- Parameters:
map
- the map to hold the values of each column- Throws:
IllegalArgumentException
- if a column does not have a name associated to it. In this case, useputColumnValuesInMapOfIndexes(Map)
instead.
-
putColumnValuesInMapOfIndexes
Fills a given map associating each column index to its list of values- Parameters:
map
- the map to hold the values of each column
-
getColumnValuesAsMapOfNames
Returns a map of column names and their respective list of values parsed from the input.- Returns:
- a map of column names and their respective list of values.
-
getColumnValuesAsMapOfIndexes
Returns a map of column indexes and their respective list of values parsed from the input.- Returns:
- a map of column indexes and their respective list of values.
-
getColumn
Returns the values of a given column.- Parameters:
columnName
- the name of the column in the input.- Returns:
- a list with all data stored in the given column
-
getColumn
Returns the values of a given column.- Parameters:
columnIndex
- the position of the column in the input (0-based).- Returns:
- a list with all data stored in the given column
-