Enum XMLSerializable.VersionSupportType
- java.lang.Object
-
- java.lang.Enum<XMLSerializable.VersionSupportType>
-
- com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<XMLSerializable.VersionSupportType>
- Enclosing interface:
- XMLSerializable
public static enum XMLSerializable.VersionSupportType extends java.lang.Enum<XMLSerializable.VersionSupportType>
Used for specifying the type of version support when used withXMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
- Since:
- API 4.600 (Geneious 6.0.0)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FormatLastChanged
Refers to most recent version of Geneious in which the class last changed its XML format such that earlier versions cannot read it.FormatLastExtended
Refers to most recent version of Geneious in which the class last extended its XML format in such a way that old versions (of at leastFormatLastChanged
) can still safely read the XMLOldestVersionSerializableTo
Refers to the oldest version of Geneious which the class supports serializing to viaXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
This class must support serializing to all major versions between this and the current version (Geneious.getMajorVersion()
inclusive viaXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geneious.MajorVersion
getVersionSupport(XMLSerializable xmlSerializable)
Helper method for implementingXMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
that returns that delegates to the given object if it implements OldVersionCompatible or returnsGeneious.getMajorVersion()
if it doesn't.static boolean
supportsVersionSerialization(XMLSerializable.OldVersionCompatible serializableInstance)
Returns true if the given instance correctly supports version serialization.static XMLSerializable.VersionSupportType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static XMLSerializable.VersionSupportType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FormatLastChanged
public static final XMLSerializable.VersionSupportType FormatLastChanged
Refers to most recent version of Geneious in which the class last changed its XML format such that earlier versions cannot read it. If it just extended the format by adding new tags such that an old version can still safely read the new xml, then associate that version withFormatLastExtended
instead. FormatLastChanged must not be greater thanFormatLastExtended
. If an implementation ofXMLSerializable.OldVersionCompatible
makes use of other XMLSerializable classes as part of its serialization, then these classes must also be OldVersionCompatible and it must use the FormatLastChanged returned by them if it is higher than its own FormatLastChanged.
-
FormatLastExtended
public static final XMLSerializable.VersionSupportType FormatLastExtended
Refers to most recent version of Geneious in which the class last extended its XML format in such a way that old versions (of at leastFormatLastChanged
) can still safely read the XML It is important that classes return the correct version when they were last extended. If they don't older versions of Geneious may think they can safely modify documents in a server database when in fact they could cause information loss.
-
OldestVersionSerializableTo
public static final XMLSerializable.VersionSupportType OldestVersionSerializableTo
Refers to the oldest version of Geneious which the class supports serializing to viaXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
This class must support serializing to all major versions between this and the current version (Geneious.getMajorVersion()
inclusive viaXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
.
-
-
Method Detail
-
values
public static XMLSerializable.VersionSupportType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (XMLSerializable.VersionSupportType c : XMLSerializable.VersionSupportType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static XMLSerializable.VersionSupportType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getVersionSupport
public Geneious.MajorVersion getVersionSupport(XMLSerializable xmlSerializable)
Helper method for implementingXMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
that returns that delegates to the given object if it implements OldVersionCompatible or returnsGeneious.getMajorVersion()
if it doesn't.- Parameters:
xmlSerializable
- the object to get the version support type for- Returns:
- the version support as defined by
XMLSerializable.OldVersionCompatible.getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
-
supportsVersionSerialization
public static boolean supportsVersionSerialization(XMLSerializable.OldVersionCompatible serializableInstance)
Returns true if the given instance correctly supports version serialization. This means that if it overrides any of the toXML methods, it must also override getVersionSupport in the same sub-class. Non-final classes that implement OldVersionCompatible should use this to test whether their sub-classes correctly override version support rather than just overriding toXML. If a sub-class just overrides toXML then we must assume it can only be serialized to the latest version of Geneious. It is strongly recommended that all classes support serializing back toVersion6_0
if possible.- Parameters:
serializableInstance
- an instance of a OldVersionCompatible to query about version serialization support.- Returns:
- true if the given instance correctly supports version serialization.
-
-