Can I instantiate a superclass and have a particular subclass be instantiated based on the parameters supplied

后端 未结 2 1127
傲寒
傲寒 2020-12-11 12:56

I am using Google\'s GSON package http://code.google.com/p/google-gson/

I am converting JSON to Java.

I have this fragment of code where I do the conversion.

2条回答
  •  感动是毒
    2020-12-11 13:43

    Sounds like you want to create a custom deserializer if you need to check the values, or an instance creator if you only need to create an instance based on type.

提交回复
热议问题