public abstract class SDRFReadInContextHandler extends SDRFReadHandler
readFrom(String[], String[],
uk.ac.ebi.arrayexpress2.magetab.datamodel.SDRF, int, int)
method that behaves in the same manner as ReadHandler.read(Object, Object, Object, int, int)
but allows a starting
index to be passed. Implementations should start from the supplied index (this will be the factor value/protocol
column) and read backwards or forwards as necessary.PROTOCOL_DELIMITER
listeners
Constructor and Description |
---|
SDRFReadInContextHandler() |
Modifier and Type | Method and Description |
---|---|
abstract int |
assessFrom(String[] header,
int columnNumber)
Return the index of the last header this handler can read from in the supplied header, starting from the given
start index.
|
abstract boolean |
canReadFrom(String[] header,
int startIndex)
Determine whether this handler can read the data referenced by this header, starting from the supplied start
index.
|
boolean |
canReadHeader(String[] header)
Determine whether this handler can read the data referenced by this header.
|
protected <T extends SDRFNode> |
fetchUpstreamNode(SDRF sdrf,
String nodeName,
Class<T> nodeClass)
Used for adding nodes that are upstream of the current node in the SDRF graph.
|
protected SDRFNode |
handleUpstreamNode(SDRF sdrf,
String nodeName,
String nodeType,
int lineNumber,
int columnNumber)
Used for adding nodes that are upstream of the current node in the SDRF graph.
|
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.
|
abstract void |
readDataFrom(String[] header,
String[] data,
SDRF sdrf,
int lineNumber,
int columnNumber)
Performs the unit of work to read the data into the internal datamodel.
|
void |
readFrom(String[] header,
String[] data,
SDRF sdrf,
int lineNumber,
int columnNumber)
Cause the handler to read some of the supplied data (usually starting from startIndex) into the supplied target
object, using additional context information where appropriate.
|
assess, assessAttribute, canRead, readAttribute, readData, updateChildNode
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 canReadHeader(String[] header)
SDRFReadHandler
canReadHeader
in class SDRFReadHandler
header
- the first token on a line, or the column heading, which is the string describing this line
contentspublic void read(String[] header, String[] data, SDRF sdrf, int lineNumber, int columnNumber) throws ParseException
ReadHandler
read
in interface ReadHandler<String[],String[],SDRF>
read
in class SDRFReadHandler
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 failedpublic void readFrom(String[] header, String[] data, SDRF sdrf, int lineNumber, int columnNumber) throws ParseException
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 this data was read fromcolumnNumber
- the index at which we want to commence reading fromParseException
- if parsing failedpublic abstract boolean canReadFrom(String[] header, int startIndex)
canReadHeader(String[])
is designed for handlers that require additional context information (handlers
for Factor Values and Protocols, usually).
The header should be passed to the handler prior to reading to determine whether this handler can handle this
line.header
- the first token on a line, or the column heading, which is the string describing this line
contentsstartIndex
- the index that designates where the data startspublic abstract int assessFrom(String[] header, int columnNumber)
header
- the header to assesscolumnNumber
- the index of the first column where this data startspublic abstract void readDataFrom(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 line 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 valueprotected SDRFNode handleUpstreamNode(SDRF sdrf, String nodeName, String nodeType, int lineNumber, int columnNumber) throws ParseException
SDRFReadInContextHandler
to provide the ability to read-back should use this method if they discover
a node reference to a parent node that has not yet been added to the SDRF graph.
This method actually creates a nested handler for generating the part of the SDRF that is described by this
header and data.sdrf
- the sdrf to querynodeName
- the name of the nodenodeType
- the entry in the headerlineNumber
- the line being readcolumnNumber
- the column being readParseException
- if the node could not be created or retrievedprotected <T extends SDRFNode> T fetchUpstreamNode(SDRF sdrf, String nodeName, Class<T> nodeClass) throws ParseException
SDRFReadInContextHandler
to provide the ability to read-back should use this method if they discover
a node reference to a parent node that has not yet been added to the SDRF graph.sdrf
- the sdrf to querynodeName
- the name of the nodenodeClass
- the class of the node requiredParseException
- if the node could not be created or retrievedCopyright © 2014. All rights reserved.