-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
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<Dog> dogs = new ArrayList<>();
// Initialization
...
// Create Jsonb and deserialize
Jsonb jsonb = JsonbBuilder.create();
dogs = jsonb.fromJson(result, new ArrayList<Dog>(){}.getClass().getGenericSuperclass());
Deserialization of generic list using TypeToken:
// List of dogs
List<Dog> dogs = new ArrayList<>();
// Initialization
...
// Create Jsonb and deserialize
Jsonb jsonb = JsonbBuilder.create();
dogs = jsonb.fromJson(result, TypeToken<List<Dog>>(){}.getType());
aguibert
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request