I have a class that I want to serialize in order to save it to a file. In terms of OO design what is the best way to go about integrating serialization into my classes?
I was going to have two static methods that would read/write an object of the class from/to a stream, where both the stream and object are paramters to the method. Would it make sense to implement it this way or would it be considered messy?
All you have to do is add implements java.io.Serializable to the class definition and make sure that any non-static non-transient data members are also serializable (and so on recursively until closure).