I am creating a Serializable object descriptor that will store important state data for a non- Serailizable entity. How do I keep the old descriptors valid across application upgrades? I was thinking of opening all of the known previous state (on upgrade) and prompt the states to upgrade themselves. Maybe via a:
void onUpgrade(int oldVersion, int newVersion, int updateFlags);
but I don't know if this is a good methodology for serializable maintenance.
I would suggest another form for your external representation. Serialized objects are hard to keep compatible as you already noted. The easiest thing to do would be to annotate your object with jaxb annotations and then use Jaxb to read/write it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With