-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone

Description
An attempt to change the default abstract type mapper from LinkedHashMap
to something else (in this case TreeMap
) does not work:
public static void main(String ... args) throws Exception
{
final ObjectMapper mapper = new ObjectMapper();
final SimpleModule module = new SimpleModule("treemaps", Version.unknownVersion());
module.addAbstractTypeMapping(Map.class, TreeMap.class);
mapper.registerModule(module);
final String ser = "{\"obj\":{\"k1\":\"v1\",\"k2\":\"v2\",\"k3\":\"v3\"}}";
final Map<String, Object> deser = mapper.readValue(ser, new TypeReference<TreeMap<String, Object>>() {});
System.out.println("Class of deser's nested object is " + deser.get("obj").getClass().getSimpleName());
}
The output of this is Class of deser's nested object is LinkedHashMap
.
This is using version 2.5.0.
Metadata
Metadata
Assignees
Labels
No labels