public abstract class IDFReadHandler extends AbstractHandler implements ReadHandler<String,String[],IDF>
MAGETABInvestigation
. This
contains most of the boilerplate code, so that specific 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 MAGETABInvestigation
object.listeners
Constructor and Description |
---|
IDFReadHandler() |
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getAllowedLength()
Get the legal number of data entries for this type of handler, as specified by the MAGE-TAB specification.
|
void |
read(String header,
String[] data,
IDF idf,
int lineNumber,
int columnNumber)
Invoke this read handler.
|
protected abstract void |
readValue(IDF idf,
String value,
int lineNumber,
String... types)
Performs the unit of work to read the data into the internal MAGE-TAB investigation.
|
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[],IDF>
header
- the data that will be validatedpublic int getAllowedLength()
public void read(String header, String[] data, IDF idf, int lineNumber, int columnNumber) throws ParseException
readValue(uk.ac.ebi.arrayexpress2.magetab.datamodel.IDF, String, int, String...)
.
This method itself governs the update of progress tracking and status information. Before this handler has
completed reading, the status of the current task index is updated to Status.COMPLETE if everything succeeded, or
Status.FAILED otherwiseread
in interface ReadHandler<String,String[],IDF>
header
- the header identifying the type of the datadata
- the data to be readidf
- 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 the handler failed to read data from it's sourceprotected abstract boolean canReadHeader(String header)
header
- the first token on a line, or the column heading, which is the string describing this line
contentsprotected abstract void readValue(IDF idf, String value, int lineNumber, String... types) throws ParseException
idf
- the IDF to read data intovalue
- the value to read into the cachelineNumber
- the line number this data is read fromtypes
- a single string representing the type, if present. Should not normally be greater than 1
element long @throws ParseException if the header cannot be parsed or there was an error
reading the valueParseException
- if the supplied data could not be parsedCopyright © 2014. All rights reserved.