public abstract class SDRFReadHandler extends AbstractHandler implements ReadHandler<String[],String[],SDRF>
MAGETABInvestigation
.
This contains most of the boilerplate code, so that specific handlers only need define the name of the tag they can
read from, the maximum number of values allowed on the line marked by this tag, and how to set the field on the
MAGETABInvestigation object.Modifier and Type | Field and Description |
---|---|
static String |
PROTOCOL_DELIMITER |
listeners
Constructor and Description |
---|
SDRFReadHandler() |
Modifier and Type | Method and Description |
---|---|
abstract int |
assess(String[] header)
Return the index of the last header this handler can read from in the supplied header.
|
protected int |
assessAttribute(SDRFAttributeReader reader,
String[] header,
int startIndex) |
boolean |
canRead(Object header)
Determine whether this handler can read the supplied header.
|
protected abstract boolean |
canReadHeader(String[] header)
Determine whether this handler can read the data referenced by this header.
|
void |
read(String[] header,
String[] data,
SDRF sdrf,
int lineNumber,
int columnNumber)
Cause the handler to read the supplied data into the supplied target object.
|
protected int |
readAttribute(SDRFAttributeReader reader,
String[] header,
String[] data,
SDRF sdrf,
SDRFNode parentNode,
int lineNumber,
int columnNumber,
int startIndex) |
protected abstract void |
readData(String[] header,
String[] data,
SDRF sdrf,
int lineNumber,
int columnNumber)
Performs the unit of work to read the data into the internal datamodel.
|
protected void |
updateChildNode(String[] header,
String[] data,
SDRFNode node,
int valueIndex) |
accept, addListener, fireHandlingFailedEvent, fireHandlingStartedEvent, fireHandlingSucceededEvent, getListeners, getLog, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, addListener, getListeners, removeListener
public static final String PROTOCOL_DELIMITER
public boolean canRead(Object header)
ReadHandler
canRead
in interface ReadHandler<String[],String[],SDRF>
header
- the data that will be validatedpublic void read(String[] header, String[] data, SDRF sdrf, int lineNumber, int columnNumber) throws ParseException
ReadHandler
read
in interface ReadHandler<String[],String[],SDRF>
header
- the header identifying the type of the datadata
- the data to be readsdrf
- the object that the data will be read intolineNumber
- the line number of the field this data was read fromcolumnNumber
- the column number of the field this data was read fromParseException
- if parsing failedprotected int assessAttribute(SDRFAttributeReader reader, String[] header, int startIndex)
protected int readAttribute(SDRFAttributeReader reader, String[] header, String[] data, SDRF sdrf, SDRFNode parentNode, int lineNumber, int columnNumber, int startIndex) throws ParseException
ParseException
protected void updateChildNode(String[] header, String[] data, SDRFNode node, int valueIndex)
protected abstract boolean canReadHeader(String[] header)
header
- the first token on a line, or the column heading, which is the string describing this line
contentspublic abstract int assess(String[] header)
header
- the header to assessprotected abstract void readData(String[] header, String[] data, SDRF sdrf, int lineNumber, int columnNumber) throws ParseException
header
- the header identifying the data to readdata
- the data to readsdrf
- the SDRF to add data tolineNumber
- the lin number this data was read fromcolumnNumber
- the first column of the data being readParseException
- if the header cannot be parsed or there was an error reading the valueCopyright © 2014. All rights reserved.