inde...@gmail.com
unread,Nov 4, 2008, 8:07:35 PM11/4/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-gson
There is no such way currently. Although, internally we use a single
type adapter for all the subclasses of Maps.
In general, the preferred approach to solve your problem will be to
use the base type in the JSON interface. In that case, only the base
type serializer/deserializer will be invoked even if the actual type
is a subtype.
But coming back to your request, I have thought about supporting this.
However, one problem is that all Subclasses will get that type adapter
whether you wanted it or not. So, you may have a sub-class which is
not a proper sub-type, but gets serialized in the standard way
nonetheless. Deserialization presents an even bigger problem since the
deserializer may return an object that can not be assigned to the
actual target field.
Am I imagining these concerns? What do you think?
Inder