Closed GoogleCodeExporter closed 9 years ago
Sorry, the example code has a small mistake, as I renamed one of the interfaces
before submitting the patch. Where it says "JsonDeserializedBy", it should say
"JsonDeserialization". The patch and the rest of my post are accurate.
Original comment by mint...@everlaw.com
on 12 Jan 2012 at 2:03
That's extremely clever!
FYI, if you're willing to make a single call to
GsonBuilder.registerTypeAdapterFactory(), I don't think you need to make any
changes to Gson 2.1 to make this work.
Original comment by jessewil...@google.com
on 12 Jan 2012 at 6:03
[deleted comment]
Will that actually work, though? From what I could tell looking at the code, a
TypeAdaptor is registered against a specific type that is later retrieved with
a map lookup. Since my method relies on any object simply implementing an
interface, doesn't that require a change to Gson?
The alternative would be for each object to register itself with some
globally-used Gson object. I preferred the interface approach.
Original comment by mint...@everlaw.com
on 18 Jan 2012 at 7:06
Original issue reported on code.google.com by
mint...@everlaw.com
on 12 Jan 2012 at 1:59Attachments: