public abstract class ALDStandardizedDataIOCmdline extends Object implements ALDDataIOCmdline
These conventions are detailed in the documentation if the methods
writeData in this class below.
They handle IO from/to file and reading derived classes of the class handled by an dataIO provider.
Classes extending this class are expected to override the methods
formatAsString which do the actual reading/parsing or writing/formating
subsequent to generic handling of Alida convention with respect to derived classes
and IO form/to file.
|Modifier and Type||Field and Description|
As a convention this character starts a derived class name, and is terminated by ':'
As a convention a parameter value starting with this character indicates that the actual parameter should be read from or writen to a file.
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns the string representations of this object This method is assumed to directly format the
Returns the external representations of this object using a formatString.
The complete content of the file is return as one string.
Returns an object instantiated from valueString.
Read an object using
Return a string representation of given object value or print it to a file.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final char FILEIO_CHAR
public static final char DERIVEDCLASS_CHAR
private boolean debug
public abstract Object parse(Field field, Class<?> cl, String valueString) throws ALDDataIOProviderException, ALDDataIOManagerException
ALDDataIOManagerCmdline.readData(Field,Class,String). This method is assumed to directly parse the
valueStringand make no prior interpretation regarding a file to use or derived class to return.
public abstract String formatAsString(Object obj) throws ALDDataIOManagerException, ALDDataIOProviderException
objinto the string return and make no prior interpretation regarding a file to be used.
public String formatAsString(Object obj, String formatString) throws ALDDataIOManagerException, ALDDataIOProviderException
formatStringmay be used define parts of the object to be formated or specify format charateristics. However,
formatStringshould not interpreted in order to decide to output the object directly to a file (as this is handled by
The default implementation is equivalent to
public Object readData(Field field, Class<?> cl, String valueString) throws ALDDataIOProviderException, ALDDataIOManagerException
valueString. For the class of the object to be read see
valueString starts with
FILEIO_CHAR the value is read from a file
where the name of this file is the remaining string of
The next step in interpreting the value string is scrutinze
whether an instance of a class deriving the class defined in
cl is to be returned.
This is indicated by starting the value string (either passed directly via
or the string read from file) with
If this is the case all charaters up, but excluding, the next colon are
interpreted as this fully qualified class name.
Next it is checked if this class indeed is a proper extension
which in turn required this class to be annotated with
If this check passes
a dataIO provider of this class is looked up and its
invoked with the value string after the deliminating colon.
If no deriving class is requested, the parse method of the
class defined in
cl is invoked on the value string.
field- Field of object to be returned.
cl- Class of object to be returned.
valueString- Source from where to read data (e.g. a filename).
public String writeData(Object obj, String formatString) throws ALDDataIOManagerException, ALDDataIOProviderException
If the given
formatString starts with
FILEIO_CHAR standard out is used as
target location, otherwise the string remaining subsequent to
FILEIO_CHAR is interpreted as file name.
In turn, if the remaining string starts with
+ the output is apended to the file (with
removed as filename).
obj- Object to be saved.
formatString- String indicated whether to return the value of where to write the value to.
Copyright © 2010–2016 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.