My question is what is a good way to implement upgrading outdated objects?
For example say you have a class like this:
public class Foo() implements Serializable {
int a;
String b;
}
and then you serialize this object. Then later on you add more functionality to your class by say adding:
...
int c;
...
You still want to retain the information that is in the serialized object but I know that if you try to deserialize it there will be conflicts. So is there a way (maybe by checking serialVersionUID) to set a value for int c
knowing that it won't exist?
Thanks
int c
or something later? Becauseb
is already aString
.