Need help using serialization
I'm reading through the example at Discover the secrets of the Java Serialization API and I'm still pretty lost. My program doesn't have a main method because it is a plug-in project but it does have an application class with a start method(This class controls all aspects of the application's execution).
I started by putting the output streams in my createPartControl() method after all the initial nodes had been created(did this to populate the nodes.ser file with initial information) and from what I can tell it worked; meaning it creates a nodes.ser file with 1kb of data.
Since the file was there I commented out most of my createPartControl() and put the input streams inside hoping it would populate from the nodes.ser file. Instead it loaded my application with no view saying(Cannot create view NavigationView, null pointer exception) and I realized my nodes.ser file was now 0kb.
I'm going to try something that just came to mind and then get back but there are some fundamental ideas I need first.
1) Do I need a separate file for each object type?(TreeObject, ServerGroup,Server, etc)
2) If I don't need separate files how can I tell what to cast the input object to if everything gets returned as Object(not Server, Build, etc)
3) Once an object has been created I can theoretically send it to file and ,as long as I don't delete the file, I can take that object creation out of my hardcode. If I run the program using that file for input and the object shows up then everything is working, correct?