Externalizable provides a clear api that has to be implemented in order to make an implementation of Document serializable and reduces the risk to fall back to the default jvm behaviour to serialize a document instance.
Modification
Implement Externalizable (which implements Serializable) and implement its api methods. The old serial methods to read and write the object were removed in favor of the new api. A test was also added to ensure the correctness of the implementation.
Result
The document api is less error-prone to serialization issues for future (or user custom) implementations.
Motivation
Externalizable provides a clear api that has to be implemented in order to make an implementation of Document serializable and reduces the risk to fall back to the default jvm behaviour to serialize a document instance.
Modification
Implement Externalizable (which implements Serializable) and implement its api methods. The old serial methods to read and write the object were removed in favor of the new api. A test was also added to ensure the correctness of the implementation.
Result
The document api is less error-prone to serialization issues for future (or user custom) implementations.