@ALDDataIOProvider public class ALDParametrizedClassDataIOXmlbeans extends ALDStandardizedDataIOXmlbeans
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 operators reading and writing is done only for IN and INOUT parameters.
In addition the set of active parameters and descriptors is set as represented in the
xml representation. For more details see the methods readData(Field, Class, ALDXMLObjectType, Object)
and {@link #writeData(Object)
Modifier and Type | Field and Description |
---|---|
private boolean |
debug
debug messages
|
Constructor and Description |
---|
ALDParametrizedClassDataIOXmlbeans() |
Modifier and Type | Method and Description |
---|---|
private void |
addParameter(String name,
Object obj,
Field field,
String formatString,
de.unihalle.informatik.Alida_xml.ALDXMLParametrizedType xmlParametrized)
Format the parameter
name of the object obj into the buffer bufstr
using formatString to determine formating. |
private static LinkedList<String> |
lookupParameternames(ALDOperator op,
String pre)
Lookup all parameter names of the operator with prefix
pre . |
Collection<Class<?>> |
providedClasses()
Interface method to announce class for which IO is provided for
|
Object |
readData(Field field,
Class<?> cl,
de.unihalle.informatik.Alida_xml.ALDXMLObjectType aldXmlObject,
Object obj)
Xmlbeans provider for parametrized classes and ALDOperators.
|
private void |
restoreParameterStatus(String pName,
ALDOperator op,
Set<String> inactiveParameternames,
Set<String> activeParameternames)
Restore the status of a parameter to the state as specified in the xml representation
Prerequisite: pName is a parameter of the operator
op and exiting in the xml representation |
private static boolean |
wasAnnotated(String pName,
de.unihalle.informatik.Alida_xml.ALDXMLKeyValuePairType[] parameterDescriptorsArray) |
de.unihalle.informatik.Alida_xml.ALDXMLObjectType |
writeData(Object obj)
Xmlbeans provider for parametrized classes and ALDOperators.
|
readData, readData, readData
public Collection<Class<?>> providedClasses()
public Object readData(Field field, Class<?> cl, de.unihalle.informatik.Alida_xml.ALDXMLObjectType aldXmlObject, Object obj) throws ALDDataIOProviderException, ALDDataIOManagerException
For parametrized classes values for all parameters which exist in the class object to restore and are also present in the xml object are restored to the value in the xml representation.
For operators first the state of active and inactive parameters is restored as close as possible
to the state in the xml representation, where changes in the class definition are taken
into account.
For all parameters in the xml representation the following cases are distinguished.
Then the values of all parameters stored in the xml representation are set to parameters of the current operator object. If a parameter does not exist in this object it is ignore.
If the value in the xml representation can not be assigned to the member variable this error is ignore for both parametrized classes and operators.
readData
in class ALDStandardizedDataIOXmlbeans
field
- cl
- obj
- if non null the xml representation is to be parse into this instance,
otherwise a new instance is created.aldXmlObject
- Source from where to read data.ALDDataIOProviderException
ALDDataIOManagerException
ALDDataIOManagerXmlbeans
public de.unihalle.informatik.Alida_xml.ALDXMLObjectType writeData(Object obj) throws ALDDataIOProviderException, ALDDataIOManagerException
For parametrized classes values for all member variables are written
which are annotated with ALDClassParameter
.
For operators all IN and INOUT parameters the values are written for both active and inactive parameters Names of all active and inactive parameters are written, as well as parameter descriptors for not annotated parameters
For both parametrized classes and operators transient members are not written.
obj
- Object to be saved.obj
ALDDataIOProviderException
ALDDataIOManagerException
private void addParameter(String name, Object obj, Field field, String formatString, de.unihalle.informatik.Alida_xml.ALDXMLParametrizedType xmlParametrized) throws ALDDataIOProviderException, ALDDataIOManagerException
name
of the object obj
into the buffer bufstr
using formatString
to determine formating.
Version 2name
- parameter to be formatedobj
- object for which to format parameterfield
- field of parameter to be formatedxmlParametrized
- String buffer to append formated parameterALDDataIOProviderException
ALDDataIOManagerException
private void restoreParameterStatus(String pName, ALDOperator op, Set<String> inactiveParameternames, Set<String> activeParameternames) throws ALDDataIOProviderException
op
and exiting in the xml representationpName
- op
- inactiveParameternames
- activeParameternames
- ALDDataIOProviderException
private 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
private static boolean wasAnnotated(String pName, de.unihalle.informatik.Alida_xml.ALDXMLKeyValuePairType[] parameterDescriptorsArray)
Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.