com.univocity.parsers.common.processor
Class MasterDetailProcessor

java.lang.Object
  extended by com.univocity.parsers.common.DefaultConversionProcessor
      extended by com.univocity.parsers.common.processor.core.AbstractObjectProcessor<T>
          extended by com.univocity.parsers.common.processor.core.AbstractMasterDetailProcessor<ParsingContext>
              extended by com.univocity.parsers.common.processor.MasterDetailProcessor
All Implemented Interfaces:
ConversionProcessor, Processor<ParsingContext>

public abstract class MasterDetailProcessor
extends AbstractMasterDetailProcessor<ParsingContext>

A RowProcessor 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 ObjectRowProcessor and value conversions provided by Conversion instances are fully supported.

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
MasterDetailRecord, RowPlacement, AbstractParser, ObjectRowListProcessor, RowProcessor

Constructor Summary
MasterDetailProcessor(ObjectRowListProcessor detailProcessor)
           
MasterDetailProcessor(RowPlacement rowPlacement, ObjectRowListProcessor detailProcessor)
          Creates a MasterDetailProcessor
 
Method Summary
 
Methods inherited from class com.univocity.parsers.common.processor.core.AbstractMasterDetailProcessor
isMasterRecord, masterDetailRecordProcessed, processEnded, processStarted, rowProcessed, rowProcessed
 
Methods inherited from class com.univocity.parsers.common.DefaultConversionProcessor
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterDetailProcessor

public MasterDetailProcessor(RowPlacement rowPlacement,
                             ObjectRowListProcessor detailProcessor)
Creates a MasterDetailProcessor

Parameters:
rowPlacement - indication whether the master records are placed in relation its detail records in the input.

 Master record (Totals)       Master record (Totals)
  above detail records         under detail records

    Totals | 100                 Item   | 60
    Item   | 60                  Item   | 40
    Item   | 40                  Totals | 100
 

detailProcessor - the ObjectRowListProcessor that processes detail rows.

MasterDetailProcessor

public MasterDetailProcessor(ObjectRowListProcessor detailProcessor)


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.