Search in sources :

Example 6 with SimpleSerializers

use of com.fasterxml.jackson.databind.module.SimpleSerializers in project Rosetta by HubSpot.

the class RosettaObjectMapperTest method registerSerializer.

private static void registerSerializer(ConfigRegistry config, JsonSerializer<TestObject> serializer) {
    ObjectMapper objectMapper = new ObjectMapper();
    SimpleModule module = new SimpleModule();
    module.setSerializers(new SimpleSerializers(Collections.singletonList(serializer)));
    objectMapper.registerModule(module);
    config.get(RosettaObjectMapper.class).setObjectMapper(objectMapper);
}
Also used : SimpleSerializers(com.fasterxml.jackson.databind.module.SimpleSerializers) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule)

Aggregations

SimpleSerializers (com.fasterxml.jackson.databind.module.SimpleSerializers)6 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)4 JsonSerializer (com.fasterxml.jackson.databind.JsonSerializer)2 Module (com.fasterxml.jackson.databind.Module)2 ClassKey (com.fasterxml.jackson.databind.type.ClassKey)2 Field (java.lang.reflect.Field)2 HashMap (java.util.HashMap)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Activate (org.apache.felix.scr.annotations.Activate)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1