当前位置: 首页>>代码示例>>Java>>正文


Java DateTimeFormatterFactory类代码示例

本文整理汇总了Java中org.springframework.format.datetime.joda.DateTimeFormatterFactory的典型用法代码示例。如果您正苦于以下问题:Java DateTimeFormatterFactory类的具体用法?Java DateTimeFormatterFactory怎么用?Java DateTimeFormatterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DateTimeFormatterFactory类属于org.springframework.format.datetime.joda包,在下文中一共展示了DateTimeFormatterFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jacksonJodaModule

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
@Bean
public JodaModule jacksonJodaModule() {
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
            new JacksonJodaFormat(formatterFactory.createDateTimeFormatter()
                    .withZoneUTC())));
    return module;
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:11,代码来源:JacksonConfiguration.java

示例2: convertObjectToJsonBytes

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
/**
 * Convert an object to JSON byte array.
 *
 * @param object
 *            the object to convert
 * @return the JSON byte array
 * @throws IOException
 */
public static byte[] convertObjectToJsonBytes(Object object)
        throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
        new JacksonJodaFormat(formatterFactory.createDateTimeFormatter()
            .withZoneUTC())));
    mapper.registerModule(module);
    return mapper.writeValueAsBytes(object);
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:22,代码来源:TestUtil.java

示例3: jacksonJodaModule

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
@Bean
public JodaModule jacksonJodaModule() {
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
            new JacksonJodaDateFormat(formatterFactory.createDateTimeFormatter().withZoneUTC())));
    return module;
}
 
开发者ID:mike-plummer,项目名称:graylog-springboot,代码行数:10,代码来源:WebMvcConfiguration.java

示例4: jacksonJodaModule

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
@Bean
public JodaModule jacksonJodaModule() {
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
            new JacksonJodaDateFormat(formatterFactory.createDateTimeFormatter()
                    .withZoneUTC())));
    return module;
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:11,代码来源:JacksonConfiguration.java

示例5: convertObjectToJsonBytes

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
/**
 * Convert an object to JSON byte array.
 *
 * @param object
 *            the object to convert
 * @return the JSON byte array
 * @throws IOException
 */
public static byte[] convertObjectToJsonBytes(Object object)
        throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
        new JacksonJodaDateFormat(formatterFactory.createDateTimeFormatter()
            .withZoneUTC())));
    mapper.registerModule(module);
    return mapper.writeValueAsBytes(object);
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:22,代码来源:TestUtil.java

示例6: jacksonJodaModule

import org.springframework.format.datetime.joda.DateTimeFormatterFactory; //导入依赖的package包/类
@Bean
public JodaModule jacksonJodaModule() {
    JodaModule module = new JodaModule();
    DateTimeFormatterFactory formatterFactory = new DateTimeFormatterFactory();
    formatterFactory.setIso(DateTimeFormat.ISO.DATE);
    module.addSerializer(DateTime.class, new DateTimeSerializer(
        new JacksonJodaFormat(formatterFactory.createDateTimeFormatter()
            .withZoneUTC())));
    return module;
}
 
开发者ID:kylesm,项目名称:vpcviewer,代码行数:11,代码来源:JacksonConfiguration.java


注:本文中的org.springframework.format.datetime.joda.DateTimeFormatterFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。