guochaiqi / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Gson needs a more obust inclusion and exclusion mechanism #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Gson has the ability to mark a method as exposed with @Expose, but another
mode would be more useful. The ability to mark a class, so that all methods
will be exposed and putting a @Conceal annotation maybe on the methods you
don't want to expose. I am running into an issue where I have Hibernate
objects that are being handed to Gson and I have properties that are lazy
loaded and Gson will try to load them if I don't mark them as transient
members. I don't want these fields to be transient and I don't want to have
to write a wrapper layer for my POJOs. I also think it is a bit of a kludge
to have to mark all of my methods as @Expose that I want to expose. I'd
rather say all methods are exposed, except ...

Original issue reported on code.google.com by chrislha...@gmail.com on 13 Aug 2009 at 12:14

GoogleCodeExporter commented 9 years ago
You can use parameters in Expose to get the effect of conceal. 

@Expose(serialize=false, deserialize=false)

Original comment by inder123 on 13 Aug 2009 at 2:22

GoogleCodeExporter commented 9 years ago
I'm using Gson 1.3 and the @Expose annotation has no properties at all.

Original comment by chrislha...@gmail.com on 13 Aug 2009 at 2:55

GoogleCodeExporter commented 9 years ago
Ah ok, this is going to be included in Gson 1.4 release.

Original comment by inder123 on 13 Aug 2009 at 4:38

GoogleCodeExporter commented 9 years ago
As noted above, this is fixed in Gson 1.4

Original comment by inder123 on 18 Aug 2009 at 5:42