rohandalvi / google-gson

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

Allow a magic field in a class to specify the default type adapter #564

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to specify the JSON serialization/deserialization semantics within my 
class itself, through a static field. 

class A {
  private static final TypeAdapter<A> GSON_TYPE_ADAPTER = .....
}

The big value is that all users of my class get automatic benefit of type 
adapter, they don't need to remember to register it.

Original issue reported on code.google.com by inder123 on 8 Mar 2014 at 8:17

GoogleCodeExporter commented 9 years ago
Fixed in https://code.google.com/p/google-gson/source/detail?r=1264

Original comment by inder123 on 8 Mar 2014 at 8:17

GoogleCodeExporter commented 9 years ago
Google group discussion at 
https://groups.google.com/forum/#!topic/google-gson/MQNmZyWoK-4

Original comment by inder123 on 8 Mar 2014 at 9:30

GoogleCodeExporter commented 9 years ago
We are reverting these changes since @Adapt is a better solution than a magic 
field.

Original comment by inder123 on 11 Mar 2014 at 6:20