public interface XMLSerializable
PluginDocument, instead of
implementing an empty constructor and implementing fromXML(org.jdom.Element) , the class may instead
throw an UnsupportedOperationException inside fromXML(org.jdom.Element) and implement a constructor
that takes a single Element as a parameter. The constructor may be private - the deserializer
will still find and call it.
XMLSerializer.classToXML(String, XMLSerializable)
and XMLSerializer.classFromXML(org.jdom.Element, Class)
should be used for serializing classes that implement XMLSerializable.| Modifier and Type | Interface and Description |
|---|---|
static interface |
XMLSerializable.OldVersionCompatible
XMLSerializable classes may implement this to indicate they support serializing to older version formats and potentially deserializing from newer version formats.
|
static class |
XMLSerializable.VersionSupportType
Used for specifying the type of version support when used with
XMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType) |
| Modifier and Type | Field and Description |
|---|---|
static String |
ROOT_ELEMENT_NAME
The default root element name.
|
static final String ROOT_ELEMENT_NAME
toXML()org.jdom.Element toXML()
fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.RuntimeException - whose cause is a XMLSerializationException if either
the serializable class is a PluginDocument and it is unable to serialize to a temporary file using PluginDocument.FILE_DATA_ATTRIBUTE_NAME.
or the serializable class is an AnnotatedPluginDocument which can't load its internal PluginDocument because for example there is insufficient memory or it is in a shared database that encounters an IOExceptionvoid fromXML(org.jdom.Element element)
throws XMLSerializationException
toXML().
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classFromXML(org.jdom.Element)
or XMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally.
It is optional to implement this method. Instead of implementing an empty constructor and implementing
this method properly, the implementation may instead
throw an UnsupportedOperationException and implement a constructor
that takes a single Element as a parameter.
This allows for cleaner code such as support for final fields in the XMLSerializable class.
The element parameter should not be modified since it may be reused. If you need a modified version of it,
take a copy with Element.clone().element - representation from a previous call to toXML()XMLSerializationException - if the Element can't be converted into this type of objectUnsupportedOperationException - if this class instead implements a constructor that takes a single
Element as a parameter. PluginDocuments
must not throw this exception.