Processor implementation for associating rows extracted from any implementation of AbstractParser into MasterDetailRecord instances.
For each row processed, a call to AbstractMasterDetailProcessor#isMasterRecord(String[], Context) will be made to identify whether or not it is a master row.
The detail rows are automatically associated with the master record in an instance of MasterDetailRecord.
When the master record is fully processed (i.e. MasterDetailRecord contains a master row and all associated detail rows),
it is sent to the user for processing in AbstractMasterDetailProcessor#masterDetailRecordProcessed(MasterDetailRecord, Context).
Note
this class extends AbstractObjectProcessor and value conversions provided by Conversion instances are fully supported.
MasterDetailRecord, RowPlacement, AbstractParser, ObjectRowListProcessor, Processor
| Modifier and Type | Field and Description |
|---|---|
| private final AbstractObjectListProcessor | |
| private final boolean | |
| private MasterDetailRecord |
| Access | Constructor and Description |
|---|---|
| public | AbstractMasterDetailProcessor(RowPlacement
indication whether the master records are placed in relation its detail records in the input.
rowPlacement, AbstractObjectListProcessor<T extends Context> Master record (Totals) Master record (Totals) above detail records under detail records Totals | 100 Item | 60 Item | 60 Item | 40 Item | 40 Totals | 100 the detailProcessor)ObjectRowListProcessor that processes detail rows.Creates a MasterDetailProcessor |
| public | AbstractMasterDetailProcessor(AbstractObjectListProcessor<T extends Context>
the detailProcessor)AbstractObjectListProcessor that processes detail rows.Creates a MasterDetailProcessor assuming master records are positioned above its detail records in the input. |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract boolean | Returns: true if the row is a master record, false if it is a detail record.the data extracted by the parser for an individual record. row, T A contextual object with information and controls over the current state of the parsing process context)Queries whether or not the given row is a master record. |
| protected abstract void | masterDetailRecordProcessed(MasterDetailRecord
The master detail records record, T A contextual object with information and controls over the current state of the parsing process context)Invoked by the processor after a master row and all associated detail rows have been processed. |
| public void | processEnded(T
A contextual object with information and controls over the state of the parsing process context)Overrides com. Implements com. |
| private void | processRecord(Object[]
a record extracted from the parser that had all (if any) conversions executed and is ready to be sent to the user. row, T A contextual object with information and controls over the current state of the parsing process context)Associates individual rows to a |
| 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 | rowProcessed(String[]
the data extracted by the parser for an individual record. row, T A contextual object with information and controls over the current state of the parsing process context)Overrides com. Implements com. |
| public final void | rowProcessed(Object[]
the data extracted by the parser for an individual record. row, T A contextual object with information and controls over the current state of the parsing process context)Implements abstract com. |
| detailProcessor | back to summary |
|---|---|
| private final AbstractObjectListProcessor<T extends Context> detailProcessor | |
| isMasterRowAboveDetail | back to summary |
|---|---|
| private final boolean isMasterRowAboveDetail | |
| record | back to summary |
|---|---|
| private MasterDetailRecord record | |
| AbstractMasterDetailProcessor | back to summary |
|---|---|
| public AbstractMasterDetailProcessor(RowPlacement rowPlacement, AbstractObjectListProcessor<T extends Context> detailProcessor) Creates a MasterDetailProcessor
| |
| AbstractMasterDetailProcessor | back to summary |
|---|---|
| public AbstractMasterDetailProcessor(AbstractObjectListProcessor<T extends Context> detailProcessor) Creates a MasterDetailProcessor assuming master records are positioned above its detail records in the input.
| |
| isMasterRecord | back to summary |
|---|---|
| protected abstract boolean isMasterRecord(String[] row, T context) Queries whether or not the given row is a master record.
| |
| masterDetailRecordProcessed | back to summary |
|---|---|
| protected abstract void masterDetailRecordProcessed(MasterDetailRecord record, T context) Invoked by the processor after a master row and all associated detail rows have been processed.
| |
| 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
| |
| processRecord | back to summary |
|---|---|
| private void processRecord(Object[] row, T context) Associates individual rows to a
| |
| 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 final void rowProcessed(String[] row, T context) Overrides com. Implements com. Invoked by the parser after all values of a valid record have been processed. This method will then try to identify whether the given record is a master record. If it is, any conversions applied to the fields of the master record will be executed; Otherwise, the parsed row will be delegated to the | |
| rowProcessed | back to summary |
|---|---|
| public final void rowProcessed(Object[] row, T context) Implements abstract com. Invoked by the parser after all values of a valid record have been processed and any conversions have been executed. | |