Closed GoogleCodeExporter closed 9 years ago
Avoid this problem by using the TypeAdapter directly. That way Gson doesn't
need to keep on looking up the type to serialize. This approach is also faster
even if there isn't contention.
public static final TypeAdapter<Foo> myFooAdapter = gson.getAdapter(Foo.class);
inder, joel: do you guys think we should encourage this?
Original comment by limpbizkit
on 30 Jun 2012 at 3:26
I apologize for my naivety in advance.
This issue is occurring as a natural use of toJson(...). How would your
suggestion resolve this (e.g. - I don't understand the equivalent API call of
gson.toJson(...) using a specific TypeAdapter)?
Original comment by dirkharr...@gmail.com
on 30 Jun 2012 at 12:38
We are running into this same issue. Using the TypeAdapter directly is not a
viable option for us because some of type information in our serialized objects
is dynamic. It seems like a simple change, and like the original author we
could potentially provide a patch. Is there a fundamental objection to making
this change, perhaps a concern about performance in low concurrency
environments, or is it just a matter of resources?
Original comment by douglas....@gmail.com
on 9 Jul 2013 at 1:30
Original issue reported on code.google.com by
dirkharr...@gmail.com
on 20 Apr 2012 at 2:31