Processor implementation for converting batches of rows extracted from any implementation of AbstractParser into columns of objects.
This uses the value conversions provided by Conversion instances.
For each row processed, a sequence of conversions will be executed to generate the appropriate object. Each resulting object will then be stored in a list that contains the values of the corresponding column.
During the execution of the process, the batchProcessed(int) method will be invoked after a given number of rows has been processed.
The user can access the lists with values parsed for all columns using the methods getColumnValuesAsList(),
getColumnValuesAsMapOfIndexes() and getColumnValuesAsMapOfNames().
After batchProcessed(int) is invoked, all values will be discarded and the next batch of column values will be accumulated.
This process will repeat until there's no more rows in the input.
AbstractParser, Processor, BatchedColumnReader, Conversion, AbstractObjectProcessor
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private int | |
| private final int | |
| private final ColumnSplitter |
| Access | Constructor and Description |
|---|---|
| public | AbstractBatchedObjectColumnProcessor(int
the number of rows to process in each batch. rowsPerBatch)Constructs a abstract batched column processor configured to invoke the |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | batchProcessed(int
the number of rows processed in the current batch. This corresponds to the number of elements of each list of each column. rowsInThisBatch)Redeclares com. getColumnValuesAsList(),
getColumnValuesAsMapOfIndexes() and getColumnValuesAsMapOfNames().
|
| public int | getBatchesProcessed()
Implements com. |
| public List | getColumn(String
the name of the column in the input. columnName)Implements com. |
| public List | getColumn(int
the position of the column in the input (0-based). columnIndex)Implements com. |
| public < the type of data in that column V> List | |
| public < the type of data in that column V> List | |
| public final List | getColumnValuesAsList()
Implements com. |
| public final Map | getColumnValuesAsMapOfIndexes()
Implements com. |
| public final Map | getColumnValuesAsMapOfNames()
Implements com. |
| public final String[] | getHeaders()
Implements com. |
| public int | getRowsPerBatch()
Implements com. |
| public void | processEnded(T
A contextual object with information and controls over the state of the parsing process context)Overrides com. Implements com. |
| public void | processStarted(T
A contextual object with information and controls over the current state of the parsing process context)Overrides com. Implements com. |
| public final void | putColumnValuesInMapOfIndexes(Map<Integer, List<Object>>
the map to hold the values of each column map)Implements com. |
| public final void | putColumnValuesInMapOfNames(Map<String, List<Object>>
the map to hold the values of each column map)Implements com. |
| public void | rowProcessed(Object[]
object array created with the information extracted by the parser and then converted. row, T A contextual object with information and controls over the current state of the parsing process context)Implements abstract com. |
| batchCount | back to summary |
|---|---|
| private int batchCount | |
| batchesProcessed | back to summary |
|---|---|
| private int batchesProcessed | |
| rowsPerBatch | back to summary |
|---|---|
| private final int rowsPerBatch | |
| splitter | back to summary |
|---|---|
| private final ColumnSplitter<Object> splitter | |
| AbstractBatchedObjectColumnProcessor | back to summary |
|---|---|
| public AbstractBatchedObjectColumnProcessor(int rowsPerBatch) Constructs a abstract batched column processor configured to invoke the
| |
| batchProcessed | back to summary |
|---|---|
| public abstract void batchProcessed(int rowsInThisBatch) Redeclares com. Doc from com. Callback to the user, where the lists with values parsed for all columns can be accessed using the methods
| |
| getBatchesProcessed | back to summary |
|---|---|
| public int getBatchesProcessed() Implements com. Doc from com. Returns the number of batches already processed
| |
| getColumn | back to summary |
|---|---|
| public List Implements com. Doc from com. Returns the values of a given column. | |
| getColumn | back to summary |
|---|---|
| public List Implements com. Doc from com. Returns the values of a given column. | |
| getColumn | back to summary |
|---|---|
| public <V> List Returns the values of a given column. | |
| getColumn | back to summary |
|---|---|
| public <V> List Returns the values of a given column. | |
| getColumnValuesAsList | back to summary |
|---|---|
| public final List Implements com. Doc from com. Returns the values processed for each column | |
| getColumnValuesAsMapOfIndexes | back to summary |
|---|---|
| public final Map Implements com. Doc from com. Returns a map of column indexes and their respective list of values parsed from the input. | |
| getColumnValuesAsMapOfNames | back to summary |
|---|---|
| public final Map Implements com. Doc from com. Returns a map of column names and their respective list of values parsed from the input. | |
| getHeaders | back to summary |
|---|---|
| public final String[] getHeaders() Implements com. Doc from com. Returns the column headers. This can be either the headers defined in | |
| getRowsPerBatch | back to summary |
|---|---|
| public int getRowsPerBatch() Implements com. Doc from com. Returns the number of rows processed in each batch
| |
| processEnded | back to summary |
|---|---|
| public void processEnded(T context) Overrides com. Implements com. Doc from com. This method will by invoked by the parser once, after the parsing process stopped and all resources were closed. It will always be called by the parser: in case of errors, if the end of the input us reached, or if the user stopped the process manually using
| |
| processStarted | back to summary |
|---|---|
| public void processStarted(T context) Overrides com. Implements com. Doc from com. This method will by invoked by the parser once, when it is ready to start processing the input.
| |
| putColumnValuesInMapOfIndexes | back to summary |
|---|---|
| public final void putColumnValuesInMapOfIndexes(Map<Integer, List<Object>> map) Implements com. Doc from com. Fills a given map associating each column index to its list of values | |
| putColumnValuesInMapOfNames | back to summary |
|---|---|
| public final void putColumnValuesInMapOfNames(Map<String, List<Object>> map) Implements com. Doc from com. Fills a given map associating each column name to its list o values | |
| rowProcessed | back to summary |
|---|---|
| public void rowProcessed(Object[] row, T context) Implements abstract com. Doc from com. Invoked by the processor after all values of a valid record have been processed and converted into an Object array. | |