Interface XMLSerializableWithProgress

  • All Superinterfaces:
    XMLSerializable
    All Known Implementing Classes:
    DefaultAlignmentDocument, DefaultPhylogenyDocument, DefaultSequenceListDocument, PhylogenyDocument

    public interface XMLSerializableWithProgress
    extends XMLSerializable
    An extended interface to XMLSerializable to support providing progress (and the ability to cancel) when serializing and deserialing. This would ideally replace XMLSerializable, but we can't do that without breaking backwards compatibility with the API.

    All implementations of XMLSerializableWithProgress must provide a constructor with parameters Element and ProgressListener thay may throw a XMLSerializationException. The constructor may throw the XMLSerializationException if the progress listener requests that it cancel.

    For PluginDocuments that implement XMLSerializableWithProgress there is also an additional requirement that they have an empty constructor and a fromXML(Element, ProgressListener) method which may throw an XMLSerializationException. This is required due to some special run time sub-classing of PluginDocuments that takes place.

    • Method Detail

      • toXML

        org.jdom.Element toXML​(jebl.util.ProgressListener progressListener)
        Convert object to a JDOM element. The representation should be complete so that the constructor can completely restore the object's representation.

        It is recommended that the returned element use XMLSerializable.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.

        Parameters:
        progressListener - for reporting progress of the serialization. The implementation may return null if the progress listener requests that it cancel.
        Returns:
        object encoded as a JDOM element
        Throws:
        java.lang.RuntimeException - whose cause is a XMLSerializationException if the serializable class is a PluginDocument and it is unable to serialize to a temporary file using PluginDocument.FILE_DATA_ATTRIBUTE_NAME.