List of usage examples for com.fasterxml.jackson.databind ObjectMapper enableDefaultTypingAsProperty
public ObjectMapper enableDefaultTypingAsProperty(DefaultTyping applicability, String propertyName)
From source file:org.nohope.jongo.JacksonProcessor.java
@Nonnull private static ObjectMapper createPreConfiguredMapper() { final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JodaModule()); mapper.registerModule(new ColorModule()); mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(AUTO_DETECT_GETTERS, false); mapper.configure(AUTO_DETECT_SETTERS, false); mapper.setSerializationInclusion(NON_NULL); mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(ANY)); mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.Id.CLASS.getDefaultPropertyName()); final SimpleModule module = new SimpleModule("jongo", Version.unknownVersion()); module.addKeySerializer(Object.class, ComplexKeySerializer.S_OBJECT); module.addKeyDeserializer(String.class, ComplexKeyDeserializer.S_OBJECT); module.addKeyDeserializer(Object.class, ComplexKeyDeserializer.S_OBJECT); //addBSONTypeSerializers(module); mapper.registerModule(module);/*from w w w . j a v a 2 s . c o m*/ return mapper; }