@Test public void shouldCreateAnObjectMapperWithDefaultConfig(){ ObjectMapper actual = JacksonFactory.createObjectMapper(mockCRestConfig, getClass()); assertNotNull(actual); assertFalse(actual.getDeserializationConfig().isEnabled(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES)); }
static ObjectMapper createObjectMapper(CRestConfig crestConfig, Class<?> source){ String prefix = source.getName(); ObjectMapper mapper = crestConfig.get(prefix + JACKSON_OBJECT_MAPPER); if(mapper != null){ return mapper; } mapper = new ObjectMapper(); Map<DeserializationConfig.Feature, Boolean> deserConfig = crestConfig.get(prefix + JACKSON_DESERIALIZER_CONFIG, DEFAULT_DESERIALIZER_CONFIG); for(Map.Entry<DeserializationConfig.Feature,Boolean> feature : deserConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } Map<SerializationConfig.Feature, Boolean> serConfig = crestConfig.get(prefix + JACKSON_SERIALIZER_CONFIG, DEFAULT_SERIALIZER_CONFIG); for(Map.Entry<SerializationConfig.Feature,Boolean> feature : serConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } return mapper; }
JacksonFactory { static ObjectMapper createObjectMapper(CRestConfig crestConfig, Class<?> source){ String prefix = source.getName(); ObjectMapper mapper = crestConfig.get(prefix + JACKSON_OBJECT_MAPPER); if(mapper != null){ return mapper; } mapper = new ObjectMapper(); Map<DeserializationConfig.Feature, Boolean> deserConfig = crestConfig.get(prefix + JACKSON_DESERIALIZER_CONFIG, DEFAULT_DESERIALIZER_CONFIG); for(Map.Entry<DeserializationConfig.Feature,Boolean> feature : deserConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } Map<SerializationConfig.Feature, Boolean> serConfig = crestConfig.get(prefix + JACKSON_SERIALIZER_CONFIG, DEFAULT_SERIALIZER_CONFIG); for(Map.Entry<SerializationConfig.Feature,Boolean> feature : serConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } return mapper; } }
JacksonFactory { static ObjectMapper createObjectMapper(CRestConfig crestConfig, Class<?> source){ String prefix = source.getName(); ObjectMapper mapper = crestConfig.get(prefix + JACKSON_OBJECT_MAPPER); if(mapper != null){ return mapper; } mapper = new ObjectMapper(); Map<DeserializationConfig.Feature, Boolean> deserConfig = crestConfig.get(prefix + JACKSON_DESERIALIZER_CONFIG, DEFAULT_DESERIALIZER_CONFIG); for(Map.Entry<DeserializationConfig.Feature,Boolean> feature : deserConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } Map<SerializationConfig.Feature, Boolean> serConfig = crestConfig.get(prefix + JACKSON_SERIALIZER_CONFIG, DEFAULT_SERIALIZER_CONFIG); for(Map.Entry<SerializationConfig.Feature,Boolean> feature : serConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } return mapper; } private  JacksonFactory(); }
JacksonFactory { static ObjectMapper createObjectMapper(CRestConfig crestConfig, Class<?> source){ String prefix = source.getName(); ObjectMapper mapper = crestConfig.get(prefix + JACKSON_OBJECT_MAPPER); if(mapper != null){ return mapper; } mapper = new ObjectMapper(); Map<DeserializationConfig.Feature, Boolean> deserConfig = crestConfig.get(prefix + JACKSON_DESERIALIZER_CONFIG, DEFAULT_DESERIALIZER_CONFIG); for(Map.Entry<DeserializationConfig.Feature,Boolean> feature : deserConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } Map<SerializationConfig.Feature, Boolean> serConfig = crestConfig.get(prefix + JACKSON_SERIALIZER_CONFIG, DEFAULT_SERIALIZER_CONFIG); for(Map.Entry<SerializationConfig.Feature,Boolean> feature : serConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } return mapper; } private  JacksonFactory();  }
JacksonFactory { static ObjectMapper createObjectMapper(CRestConfig crestConfig, Class<?> source){ String prefix = source.getName(); ObjectMapper mapper = crestConfig.get(prefix + JACKSON_OBJECT_MAPPER); if(mapper != null){ return mapper; } mapper = new ObjectMapper(); Map<DeserializationConfig.Feature, Boolean> deserConfig = crestConfig.get(prefix + JACKSON_DESERIALIZER_CONFIG, DEFAULT_DESERIALIZER_CONFIG); for(Map.Entry<DeserializationConfig.Feature,Boolean> feature : deserConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } Map<SerializationConfig.Feature, Boolean> serConfig = crestConfig.get(prefix + JACKSON_SERIALIZER_CONFIG, DEFAULT_SERIALIZER_CONFIG); for(Map.Entry<SerializationConfig.Feature,Boolean> feature : serConfig.entrySet()){ mapper.configure(feature.getKey(), feature.getValue()); } return mapper; } private  JacksonFactory();   }