mathwl / google-gson

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

Enhance support for InstanceCreator #432

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great if gson supported the notion a global InstanceCreator, one 
which is delegated to for the construction of all types. API could be something 
along the lines of:

GsonBuilder.registerInstanceCreator(InstanceCreator)

This would allow easier delegation to Guice, Spring, etc., for the construction 
of all objects to be populated by gson as opposed to registering one 
InstanceCreator per type, as is currently required.

Alternatively, the registerTypeHierarchyAdapter method could be enhanced to 
support instance creators, such that a "global" InstanceCreator could 
effectively be registered as one that creates instances of base type 
Object.class.

Original issue reported on code.google.com by pacesysj...@gmail.com on 8 Apr 2012 at 5:20

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 11 Apr 2012 at 8:34