use of io.joynr.messaging.serialize.JoynrEnumSerializer in project joynr by bmwcarit.
the class AbstractBounceProxyServerTest method getObjectMapper.
// ///////////////////////
// HELPERS
private ObjectMapper getObjectMapper() {
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
// objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS,
// true);
objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, true);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
objectMapper.enableDefaultTypingAsProperty(DefaultTyping.JAVA_LANG_OBJECT, "_typeName");
TypeResolverBuilder<?> joynrTypeResolverBuilder = objectMapper.getSerializationConfig().getDefaultTyper(SimpleType.construct(Object.class));
SimpleModule module = new SimpleModule("NonTypedModule", new Version(1, 0, 0, "", "", ""));
module.addSerializer(new JoynrEnumSerializer());
module.addSerializer(new JoynrListSerializer());
TypeDeserializer typeDeserializer = joynrTypeResolverBuilder.buildTypeDeserializer(objectMapper.getDeserializationConfig(), SimpleType.construct(Object.class), null);
module.addDeserializer(Object.class, new JoynrUntypedObjectDeserializer(typeDeserializer));
objectMapper.registerModule(module);
return objectMapper;
}
Aggregations