I’ve got a few questions on the topic of serializing complex objects and writing them to a file.
First, I’ve got a few objects which are connected to each other, in more precise ways I have an object which holds another objects in a list which are also holding another object. so, the overall architecture of the object I want to write to the file looks as follows:
ComplexObject
-> holds List of NotSoComplexObject(s)
--> every NotSoComplexObject
---> holds a SimpleObject
all of the objects implement the Serializable interface.
if I try to serialize the ComplexObject and write it to a file I got no specific Exception as the
Exception.getMessage()
method returns NULL (so, it’s an Exception that is being thrown, but it’s not clear which Exception it is).
Is there a way to achieve the ComplexObject to be serialized and stored in a file?
The exception itself tells you what type it is. I assume its NotSerializableException.
In Java you might do…