org.zalando.jackson.datatype.money.MoneyModule Java Examples
The following examples show how to use
org.zalando.jackson.datatype.money.MoneyModule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JacksonModule.java From proteus with Apache License 2.0 | 6 votes |
@Override protected void configure() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); objectMapper.configure(DeserializationFeature.EAGER_DESERIALIZER_FETCH,true); objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true); objectMapper.registerModule(new MoneyModule()) .registerModule(new AfterburnerModule()) .registerModule(new Jdk8Module()); this.bind(ObjectMapper.class).toInstance(objectMapper); }
Example #2
Source File: ObjectMapperCustomizer.java From moserp with Apache License 2.0 | 6 votes |
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (!(bean instanceof ObjectMapper)) { return bean; } ObjectMapper mapper = (ObjectMapper) bean; mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); mapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); registerQuantitySerializer(mapper); mapper.registerModules(new MoneyModule(), new JavaTimeModule(), new Jackson2HalModule()); return mapper; }
Example #3
Source File: ObjectMapperBuilder.java From moserp with Apache License 2.0 | 5 votes |
public ObjectMapper build() { ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); mapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); registerQuantitySerializer(mapper); mapper.registerModules(new MoneyModule(), new JavaTimeModule(), new Jackson2HalModule()); return mapper; }
Example #4
Source File: ObjectMapperBuilder.java From moserp with Apache License 2.0 | 5 votes |
public ObjectMapper build() { ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); mapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); registerQuantitySerializer(mapper); mapper.registerModules(new MoneyModule(), new JavaTimeModule(), new Jackson2HalModule()); return mapper; }
Example #5
Source File: JacksonConfig.java From bearchoke with Apache License 2.0 | 5 votes |
@Bean public ObjectMapper objectMapper() { Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); builder.featuresToDisable( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS ); builder.featuresToEnable( SerializationFeature.WRITE_DATES_WITH_ZONE_ID, // SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, // SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, // DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT ); builder.indentOutput(true); builder.failOnEmptyBeans(false); builder.failOnUnknownProperties(false); // do not include null value in json to make object graph smaller builder.serializationInclusion(JsonInclude.Include.NON_NULL); builder.modules(new GeoJsonModule(), new JavaTimeModule(), new MoneyModule()); return builder.build(); }
Example #6
Source File: MockServerConfig.java From bearchoke with Apache License 2.0 | 5 votes |
@Bean(name = "customObjectMapper") public ObjectMapper customObjectMapper() { Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); builder.featuresToDisable( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS ); builder.featuresToEnable( SerializationFeature.WRITE_DATES_WITH_ZONE_ID, // SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, // SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, // DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT ); builder.indentOutput(true); builder.failOnEmptyBeans(false); builder.failOnUnknownProperties(false); // do not include null value in json to make object graph smaller builder.serializationInclusion(JsonInclude.Include.NON_NULL); builder.modules(new GeoJsonModule(), new JavaTimeModule(), new MoneyModule()); return builder.build(); }
Example #7
Source File: Main.java From fahrschein with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws IOException, InterruptedException { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); objectMapper.registerModule(new JavaTimeModule()); objectMapper.registerModule(new Jdk8Module()); objectMapper.registerModule(new MoneyModule()); objectMapper.registerModule(new ParameterNamesModule()); final Listener<SalesOrderPlaced> listener = events -> { if (Math.random() < 0.0000001) { // For testing reconnection logic throw new EventProcessingException("Random failure"); } else { for (SalesOrderPlaced salesOrderPlaced : events) { final SalesOrder order = salesOrderPlaced.getSalesOrder(); LOG.info("Received sales order [{}] created at [{}]", order.getOrderNumber(), order.getCreatedAt()); } } }; //subscriptionListen(objectMapper, listener); subscriptionListenHttpComponents(objectMapper, listener); //subscriptionListenSpringAdapter(objectMapper, listener); //subscriptionListenWithPositionCursors(objectMapper, listener); //subscriptionMultipleEvents(objectMapper); //simpleListen(objectMapper, listener); //persistentListen(objectMapper, listener); //subscriptionCreateWithAuthorization(objectMapper, listener); //multiInstanceListen(objectMapper, listener); }
Example #8
Source File: RestConfiguration.java From moserp with Apache License 2.0 | 4 votes |
@Bean public Module moneyModule() { return new MoneyModule(); }