Processor implementation for storing all rows parsed and converted to Object arrays into a list.
A typical use case of this class will be:
ObjectRowListProcessor processor = new ObjectRowListProcessor(); processor.convertIndexes(Conversions.toBigDecimal()).set(4, 6); parserSettings.setRowProcessor(new ObjectRowListProcessor()); parser.parse(reader); // will invoke the {@link AbstractObjectListProcessor#rowProcessed(Object[], T)} method for each parsed record. String[] headers = rowProcessor.getHeaders(); List<Object[]> rows = rowProcessor.getRows(); BigDecimal value1 = (BigDecimal) row.get(4); BigDecimal value2 = (BigDecimal) row.get(6);
AbstractParser, Processor, AbstractProcessor, AbstractObjectProcessor
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private String[] | |
| private List |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractObjectListProcessor(int expectedRowCount)
Creates a new processor of |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | |
| public List | Returns: the list of parsed and converted recordsReturns the list of parsed and converted records |
| 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 void | rowProcessed(Object[]
the data extracted by the parser for an individual record and converted to an Object array. row, T A contextual object with information and controls over the current state of the parsing process context)Implements abstract com. |
| expectedRowCount | back to summary |
|---|---|
| private final int expectedRowCount | |
| headers | back to summary |
|---|---|
| private String[] headers | |
| rows | back to summary |
|---|---|
| private List<Object[]> rows | |
| AbstractObjectListProcessor | back to summary |
|---|---|
| public AbstractObjectListProcessor() Creates a new processor of | |
| AbstractObjectListProcessor | back to summary |
|---|---|
| public AbstractObjectListProcessor(int expectedRowCount) Creates a new processor of | |
| getHeaders | back to summary |
|---|---|
| public String[] getHeaders() Returns the record headers. This can be either the headers defined in
| |
| getRows | back to summary |
|---|---|
| public List Returns the list of parsed and converted records | |
| 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.
| |
| rowProcessed | back to summary |
|---|---|
| public void rowProcessed(Object[] row, T context) Implements abstract com. Stores the row extracted by the parser and them converted to an Object array into a list. | |