I'm registering KeyDeseriliser
to ObjectMapper
. After reading JSON
I want to unregister this module. Because my ObjectMapper
is static and I don't want to use this module in any other places.
SimpleModule module = new SimpleModule("EnhancedDatesModule", new Version(0, 1, 0, "test", "Test-id",
"testest"));
module.addKeyDeserializer(EncounterCURN.class, new MapKeyDeseriliser());
objectMapper.registerModule(module);
Map<EncounterCURN, Collection<EncounterTodo>> encounterTodosByEncounter = mapReader.readValue(nodes.get("todos"));
No, you can not do this. You should create another ObjectMapper
and use it.
By the way, static
fields this is a not a good habit of programming in Java. You should avoid situations like this where such kind of objects are static
.