public abstract class ADFGraphReadHandler extends AbstractHandler implements ReadHandler<String[],String[],ADF>
ReadHandler
for reading from the graph part of an ADF file into a ADF object.
This implementation governs all common functionality including general handling order and progress tracking. Specific
concrete handlers only need define the header they can read, the maximum number of values allowed on the line marked
by this tag, and how to set the field on the ADF object.listeners
Constructor and Description |
---|
ADFGraphReadHandler() |
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(ADFAttributeReader 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,
ADF adf,
int lineNumber,
int columnNumber)
Cause the handler to read the supplied data into the supplied target object.
|
protected int |
readAttribute(ADFAttributeReader reader,
String[] header,
String[] data,
ADFNode parentNode,
int startIndex) |
protected abstract void |
readData(String[] header,
String[] data,
ADF adf,
int lineNumber,
int columnNumber)
Performs the unit of work to read the data into the internal datamodel.
|
protected void |
updateChildNode(String[] header,
String[] data,
ADFNode 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 boolean canRead(Object header)
ReadHandler
canRead
in interface ReadHandler<String[],String[],ADF>
header
- the data that will be validatedpublic void read(String[] header, String[] data, ADF adf, int lineNumber, int columnNumber) throws ParseException
ReadHandler
read
in interface ReadHandler<String[],String[],ADF>
header
- the header identifying the type of the datadata
- the data to be readadf
- 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(ADFAttributeReader reader, String[] header, int startIndex)
protected int readAttribute(ADFAttributeReader reader, String[] header, String[] data, ADFNode parentNode, int startIndex) throws ParseException
ParseException
protected void updateChildNode(String[] header, String[] data, ADFNode 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, ADF adf, int lineNumber, int columnNumber) throws ParseException
header
- the header identifying the data to readdata
- the data to readadf
- the ADF to populate with parsed datalineNumber
- the line this data is read fromcolumnNumber
- the column this data is read fromParseException
- if the header cannot be parsed or there was an error reading the valueCopyright © 2014. All rights reserved.