Hi!
I would like to serialize an unmarshalled XML, together
with the extra stuff that I put into the non-"Data"
classes.
To try out if it could work at all, I made several classes
of JBind serializable (see attached file).
Unfortunately, it does not work. The main problem is
related to enumeration data types of my application and
also of JBind itself (e.g. schema stuff).
Problem:
Enumeration options are represented as static final
instances of the type. Of course, these values are also
written, when elements are serialized. On deserialization
the enumeration options from the input stream are not
replaced by the values from the constants, leading to
duplicates.
Possible Solution:
It should be possible to match duplicated enumeration
options (e.g. using equals()) and the generated
enumeration datatype classes should implement the
readResolve() method (see java.io.Serialization Javadoc)
to perform the replacement of deserialized values with
the constants.
Is it possible that the code generator be changed in this
way to support serialization?
Thanks,
Alex
Classes to be made serializable