There is a class that I want to serialize, and it implements Serializable, but one of the objects that it contains does not implement Serializable.
Is there a way to change the class at runtime so that it implements the Serializable interface so that I can serialize it? I cannot change it at compile time because its a third-party library.
Perhaps I would have to use some kind of script for bytecode or something else?
EDIT: both the containing class and the containing class are in a third-party library, so I donβt think I can mention something temporary. The containing class is marked as serializable, but contains an object that is not.
I'm fine with writing a custom serialization method for a class, not sure how I would do this, but should I use reflection to get the values ββof private variables?
java serialization
Kyle
source share