How to handle deserializing with polymorphism?

前端 未结 4 557
既然无缘
既然无缘 2020-11-27 17:04

I have a class like:

public class Barn {
    String type;
    Animal animal;
}

public class Horse extends Animal {
}

public class Cow extends Animal {
}
         


        
4条回答
  •  萌比男神i
    2020-11-27 17:49

    I'm also interested in the feature and I've added a feature request to GSon

    https://github.com/google/gson/issues/869

提交回复
热议问题