Arch4J 1.1

org.arch4j.parse
Class FixedRecordReaderTest.TestRecordHandler

java.lang.Object
  |
  +--org.arch4j.parse.FixedRecordReaderTest.TestRecordHandler
All Implemented Interfaces:
InputRecordHandler
Enclosing class:
FixedRecordReaderTest

protected class FixedRecordReaderTest.TestRecordHandler
extends Object
implements InputRecordHandler


Field Summary
protected  int endCount
           
protected  int errorCount
           
protected  String lastErrorMsg
           
protected  List records
           
protected  int startCount
           
 
Method Summary
 void end()
          this method is called by the record reader after the last record has been read, when the end of the stream is reached.
 void error(int recordNumber, String errorMsg, String[] rawData)
          this method is called by the record reader when it is unable to read a record into a record object.
 Date getDateField(int recordNumber, String fieldName)
           
 Object getField(int recordNumber, String fieldName)
           
 Number getNumberField(int recordNumber, String fieldName)
           
 String getStringField(int recordNumber, String fieldName)
           
 boolean newRecord(int recordNumber, RecordData newRecord, String[] rawData)
          this method is called by the reader each time a record is successfully read and loaded into an RecordData object.
 void start()
          this method is called by the record reader before reading the first record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startCount

protected int startCount

endCount

protected int endCount

errorCount

protected int errorCount

records

protected List records

lastErrorMsg

protected String lastErrorMsg
Method Detail

getField

public Object getField(int recordNumber,
                       String fieldName)

getStringField

public String getStringField(int recordNumber,
                             String fieldName)

getDateField

public Date getDateField(int recordNumber,
                         String fieldName)

getNumberField

public Number getNumberField(int recordNumber,
                             String fieldName)

start

public void start()
Description copied from interface: InputRecordHandler
this method is called by the record reader before reading the first record.

Specified by:
start in interface InputRecordHandler

newRecord

public boolean newRecord(int recordNumber,
                         RecordData newRecord,
                         String[] rawData)
                  throws RecordDataInputException
Description copied from interface: InputRecordHandler
this method is called by the reader each time a record is successfully read and loaded into an RecordData object. If the raw data cannot be converted to a record object, the RecordReader will add the record to an edit (reject) file with an appriate message about the cause. If the record is created successfully, but the handler throws an RecordDataInputException, the record is added to the edit stream, along with the information provided in the exception.

Specified by:
newRecord in interface InputRecordHandler
Parameters:
recordNumber - sequential number assigned to each record, whether it failed or succeeded, starting at 1 for the first record in the stream.
newRecord - record object containg data values read for this record.
rawData - text data from input file used to create this record.
Returns:
true if the parser should continue parsing records.
Throws:
RecordDataInputException - if record handling failed.

error

public void error(int recordNumber,
                  String errorMsg,
                  String[] rawData)
Description copied from interface: InputRecordHandler
this method is called by the record reader when it is unable to read a record into a record object.

Specified by:
error in interface InputRecordHandler
Parameters:
recordNumber - sequential number assigned to each record, whether it failed or succeeded, starting at 1 for the first record in the stream.
errorMsg - descriprtion of the error that occured.
rawData - text data from the input stream which failed to produce a record.

end

public void end()
Description copied from interface: InputRecordHandler
this method is called by the record reader after the last record has been read, when the end of the stream is reached.

Specified by:
end in interface InputRecordHandler

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.