當前位置: 首頁>>代碼示例>>Java>>正文


Java MoneyModule類代碼示例

本文整理匯總了Java中org.zalando.jackson.datatype.money.MoneyModule的典型用法代碼示例。如果您正苦於以下問題:Java MoneyModule類的具體用法?Java MoneyModule怎麽用?Java MoneyModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MoneyModule類屬於org.zalando.jackson.datatype.money包,在下文中一共展示了MoneyModule類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postProcessAfterInitialization

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
@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;
}
 
開發者ID:thomasletsch,項目名稱:moserp,代碼行數:19,代碼來源:ObjectMapperCustomizer.java

示例2: build

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
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;
}
 
開發者ID:thomasletsch,項目名稱:moserp,代碼行數:13,代碼來源:ObjectMapperBuilder.java

示例3: objectMapper

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
@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();
    }
 
開發者ID:bjornharvold,項目名稱:bearchoke,代碼行數:29,代碼來源:JacksonConfig.java

示例4: customObjectMapper

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
@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();
    }
 
開發者ID:bjornharvold,項目名稱:bearchoke,代碼行數:29,代碼來源:MockServerConfig.java

示例5: main

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
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);

        //multiInstanceListen(objectMapper, listener);
    }
 
開發者ID:zalando-nakadi,項目名稱:fahrschein,代碼行數:45,代碼來源:Main.java

示例6: moneyModule

import org.zalando.jackson.datatype.money.MoneyModule; //導入依賴的package包/類
@Bean
public Module moneyModule() {
    return new MoneyModule();
}
 
開發者ID:thomasletsch,項目名稱:moserp,代碼行數:5,代碼來源:RestConfiguration.java


注:本文中的org.zalando.jackson.datatype.money.MoneyModule類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。