For some unknown reason if I have:
class A{
int stars;
public int getStars(){
return stars;
}
public void setStarts(int stars){
this.stars = stars;
}
}
class B extends A{
int sunshines;
[getter and setter for sunshines]
}
class C{
List<A> classes;
[get and set for classes]
}
if I serialize an Object of type C I have only the fields of A in the serialized objects in the field classes (while I would expect to have the fields of B if the object is a B).
How to do that?
See Question&Answers more detail:os