I’ve got a class Foo, it’s Serializable. It represents a graphical object, and I want it to restore its handles to the state before serializing. All data is stored within the object, I just need a method to be called in the right moment. How can I achieve it? Is this possible in Java?
(I have my Foos in a List in Bar object, and in some other places – that’s why I don’t want to do it manually.)
Implement this method, and call
in.defaultReadObject(), and then do whatever custom logic you want.Check the docs of
java.io.Serializablefor more details