Interface XMLSerializable
-
- All Known Subinterfaces:
AdvancedSearchQueryTerm
,AminoAcidSequenceDocument
,BasicSearchQuery
,ChromatogramDocument
,CompoundSearchQuery
,DocumentSelectionOption.DoNotRememberInPreferences
,EditableNucleotideGraphSequenceDocument
,EditableSameTaxaTreesDocument
,EditableSequenceDocument
,FolderViewDocument
,JournalArticleDocument
,MolecularStructureDocument
,NucleotideGraphSequenceDocument
,NucleotideSequenceDocument
,PluginDocument
,PublicationDocument
,Query
,RootedTreeDocument
,SameTaxaTreesDocument
,SequenceAlignmentListDocument
,SequenceDocument
,SequenceDocumentWithEditableAnnotations
,SummaryDocument
,TaxonomyDocument
,TreeDocument
,XMLSerializableWithProgress
- All Known Implementing Classes:
AbstractPluginDocument
,AliasDocument
,AnnotatedPluginDocument
,Author
,CmlDocument
,CodonUsageTableDocument
,CombinedAlignmentAndAminoAcidSequenceDocument
,CombinedAlignmentAndNucleotideGraphSequenceDocument
,CombinedAlignmentAndNucleotideSequenceDocument
,CombinedAlignmentAndSequenceDocument
,DefaultAlignmentDocument
,DefaultAminoAcidSequence
,DefaultMolecularStructureDocument
,DefaultNucleotideGraphSequence
,DefaultNucleotideSequence
,DefaultPhylogenyDocument
,DefaultSameTaxaTreesDocument
,DefaultSequenceDocument
,DefaultSequenceListDocument
,DefaultTreeDocument
,DocumentCollection
,DocumentField
,DocumentHistoryEntry
,DocumentHistoryEntryField
,DocumentSelectionOption
,DocumentSelectionSignature
,EValue
,FolderView
,GprDocument
,HinDocument
,ImmutableSequence
,ImmutableSequenceImplementation
,Interval
,MolDocument
,NwoDocument
,OligoSequenceDocument
,OperationLocationOptions
,OperationRecordDocument
,Options
,Options.BooleanOption
,Options.ButtonOption
,Options.ComboBoxOption
,Options.DateOption
,Options.DoubleOption
,Options.EditableComboBoxOption
,Options.ExecutableFileSelectionOption
,Options.FileSelectionOption
,Options.IntegerOption
,Options.LabelOption
,Options.MultipleLineStringOption
,Options.MultipleOptions
,Options.Option
,Options.OptionValue
,Options.RadioOption
,Options.StringOption
,PasswordOption
,PdbDocument
,Percentage
,PhylogenyDocument
,QueryField
,SequenceAlignmentDocument
,SequenceAnnotation
,SequenceAnnotationGenerator.SelectionGrabOption
,SequenceCharSequence
,SequenceListOnDisk
,SequenceListSummary
,SequencePropertiesStorage
,SequenceSelection
,SequenceSelectionWithDocuments
,SequenceSelectionWithDocuments.ExtractionStrategy
,TextDocument
,ValueAndFrequencyDistribution
,XyzDocument
public interface XMLSerializable
Interface for handling persistent objects. Persistent Geneious objects need to be written to a file and re-constructed from the contents of that file. To achieve this an object provides a conversion to/from a JDOM element, which can then be stored inside an XML file. Anything that implements this interface, should also have an empty constructor, which will be called immediately prior to the fromXML call. The constructor may be private - the deserializer will still find and call it. Alternatively, if this is not aPluginDocument
, instead of implementing an empty constructor and implementingfromXML(org.jdom.Element)
, the class may instead throw an UnsupportedOperationException insidefromXML(org.jdom.Element)
and implement a constructor that takes a singleElement
as a parameter. The constructor may be private - the deserializer will still find and call it.XMLSerializer.classToXML(String, XMLSerializable)
andXMLSerializer.classFromXML(org.jdom.Element, Class)
should be used for serializing classes that implement XMLSerializable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
XMLSerializable.OldVersionCompatible
XMLSerializable classes are recommended 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 withXMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ROOT_ELEMENT_NAME
The default root element name.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned bytoXML()
.org.jdom.Element
toXML()
Convert object to a JDOM element.
-
-
-
Field Detail
-
ROOT_ELEMENT_NAME
static final java.lang.String ROOT_ELEMENT_NAME
The default root element name. SeetoXML()
- See Also:
- Constant Field Values
-
-
Method Detail
-
toXML
org.jdom.Element toXML()
Convert object to a JDOM element. The representation should be complete so thatfromXML(org.jdom.Element)
can completely restore the object's representation. It is recommended that the returned element useROOT_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 callXMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally. PluginDocument implementations of this method may choose to throw anXMLSerializationException
, enclosed in aRuntimeException
.- Returns:
- object encoded as a JDOM element
- Throws:
java.lang.RuntimeException
- whose cause is aXMLSerializationException
if either the serializable class is aPluginDocument
and it is unable to serialize to a temporary file usingPluginDocument.FILE_DATA_ATTRIBUTE_NAME
. or the serializable class is anAnnotatedPluginDocument
which can't load its internal PluginDocument because for example there is insufficient memory or it is in a shared database that encounters an IOException
-
fromXML
void fromXML(org.jdom.Element element) throws XMLSerializationException
Restore the object from the JDOM Element returned bytoXML()
. This method generally should not be called directly. Instead, you should usually callXMLSerializer.classFromXML(org.jdom.Element)
orXMLSerializer.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 singleElement
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 withElement.clone()
.- Parameters:
element
- representation from a previous call totoXML()
- Throws:
XMLSerializationException
- if the Element can't be converted into this type of objectjava.lang.UnsupportedOperationException
- if this class instead implements a constructor that takes a singleElement
as a parameter.PluginDocument
s must not throw this exception.
-
-