google / google/gson

Enhance support for InstanceCreator

Open
#432 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

```
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.