|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.dataio.provider.cmdline.ALDStandardizedDataIOCmdline
de.unihalle.informatik.Alida.dataio.provider.cmdline.ALDParametrizedClassDataIOCmdline
@ALDDataIOProvider public class ALDParametrizedClassDataIOCmdline
DataIO provider for parametrized classes and operators from command line.
As this provider extends ALDStandardizedDataIOCmdline
it
implements the Alida syntax conventions.
For parametrized classes reading is done only for parameters annotated
with ALDClassParameter
.
Either all annotated parameters are written/formated or a
subset as specified by a format string.
For oeprators reading is done only for IN and INOUT parameters. Either all OUT and INPUT parameters are written/formated or a subset as specified by a format string.
Field Summary |
---|
Fields inherited from class de.unihalle.informatik.Alida.dataio.provider.cmdline.ALDStandardizedDataIOCmdline |
---|
DERIVEDCLASS_CHAR, FILEIO_CHAR |
Constructor Summary | |
---|---|
ALDParametrizedClassDataIOCmdline()
|
Method Summary | |
---|---|
String |
formatAsString(Object obj)
Generic formatter to string of parametrized classes. |
String |
formatAsString(Object obj,
String formatString)
Format all parameters of this parametrized class annotated with ALDClassParameter
into a string. |
static LinkedList<String> |
lookupParameternames(ALDOperator op,
String pre)
Lookup all parameter names of the operator with prefix pre . |
Object |
parse(Field field,
Class<?> cl,
String valueString)
Parser for parametrized classes and ALDOperators. |
Object |
parse(Field field,
Class<?> cl,
String valueString,
ALDOperator op)
Generic Parser for parametrized classes and ALDOperators. |
Collection<Class<?>> |
providedClasses()
Interface method to announce class for which IO is provided for |
Methods inherited from class de.unihalle.informatik.Alida.dataio.provider.cmdline.ALDStandardizedDataIOCmdline |
---|
readData, writeData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ALDParametrizedClassDataIOCmdline()
Method Detail |
---|
public Collection<Class<?>> providedClasses()
public Object parse(Field field, Class<?> cl, String valueString) throws ALDDataIOProviderException, ALDDataIOManagerException
ALDDataIOCmdline
.
For parametrized classes each name has to be an annotated parameter.
For operators each name has to be an IN or INOUT parameter name of the operator and receives its value from
the valueString
.
If the list of name=value pairs is empty, i.e. no parameters are to be parsed, the empty string is accepted, too.
parse
in class ALDStandardizedDataIOCmdline
field
- Field of object to be returnedcl
- Class of object to be returned.valueString
- Source from where to read data (e.g. a filename).
ALDDataIOProviderException
ALDDataIOManagerException
ALDDataIOManagerCmdline
public Object parse(Field field, Class<?> cl, String valueString, ALDOperator op) throws ALDDataIOProviderException, ALDDataIOManagerException
ALDDataIOCmdline
.
For parametrized classes each name has to be an annotated parameter.
For operators each name has to be an IN or INOUT parameter name of the operator and receives its value from
the valueString
.
If the list of name=value pairs is empty, i.e. no parameters are to be parsed, the empty string is accepted, too.
For the class of the object to be read see ALDDataIOCmdline
.
As a valueString
a comma separated list of name=value pairs enclosed in curly brackets
is expected. Each name has to be a member of the class or a super class which is annotated
with ALDClassParameter
.
The readData
method of the provider for the class of the member variable
is used to read the objects value from value
.
field
- cl
- valueString
- op
- if a ALDOperator is to be parse this is an instance of this class. Ignored when parsing
a parametrized class
ALDDataIOProviderException
ALDDataIOManagerException
public String formatAsString(Object obj, String formatString) throws ALDDataIOProviderException, ALDDataIOManagerException
ALDClassParameter
into a string.
If formatString
starts with a curly bracket it is assume
to contained a comma seprated list of name=value pairs enclosed in a
matching curly brackets.
In this case, only the (annotated) members named in this list are formated where the value
is passed to the writeData
of the dataIO provider handling the parameter's type.
In extension, is a name equals *
all members non listed in the
formatString
are formated using the value
of this pair.
If formatString
does not start with a curly bracket all annotated
members are formated.
formatAsString
in class ALDStandardizedDataIOCmdline
obj
- parametrized class to be formatedformatString
-
ALDDataIOProviderException
ALDDataIOManagerException
public String formatAsString(Object obj) throws ALDDataIOProviderException, ALDDataIOManagerException
ALDClassParameter
.
formatAsString
in class ALDStandardizedDataIOCmdline
obj
- object to format
ALDDataIOProviderException
ALDDataIOManagerException
public static LinkedList<String> lookupParameternames(ALDOperator op, String pre)
pre
.
If one of the parameters exactly matches pre
only this single
parameter name is returned.
pre
or the single parameter
exactly matching pre
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |