jakartaee / jakartaee/jsonb-api
Support of TypeToken
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
Extend deserialize family with a method accepting `TypeToken`. It's more convenient and user friendly than using pure `Type`. Similar mechanism is used in Gson and Jackson.
Deserialization of generic list as it is now:
```
// List of dogs
List dogs = new ArrayList<>();
// Initialization
...
// Create Jsonb and deserialize
Jsonb jsonb = JsonbBuilder.create();
dogs = jsonb.fromJson(result, new ArrayList(){}.getClass().getGenericSuperclass());
```
Deserialization of generic list using TypeToken:
```
// List of dogs
List dogs = new ArrayList<>();
// Initialization
...
// Create Jsonb and deserialize
Jsonb jsonb = JsonbBuilder.create();
dogs = jsonb.fromJson(result, TypeToken>(){}.getType());
```
Contributor guide
Research direction
Start by locating the deserialize family in the JSON-B API and reviewing its existing Type-based overloads. Compare the requested TypeToken usage with the current generic-list example, then verify that the API and tests cover deserialization through the new form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100