• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LocalDateDeserializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer的典型用法代码示例。如果您正苦于以下问题:Java LocalDateDeserializer类的具体用法?Java LocalDateDeserializer怎么用?Java LocalDateDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocalDateDeserializer类属于com.fasterxml.jackson.datatype.jsr310.deser包,在下文中一共展示了LocalDateDeserializer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: convertObjectToJsonBytes

import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; //导入依赖的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);

    JavaTimeModule module = new JavaTimeModule();
    module.addSerializer(ZonedDateTime.class, new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
    module.addDeserializer(LocalDate.class, new LocalDateDeserializer(ISO_DATE_OPTIONAL_TIME));
    mapper.registerModule(module);

    return mapper.writeValueAsBytes(object);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:21,代码来源:TestUtil.java


示例2: postConstruct

import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; //导入依赖的package包/类
@PostConstruct
public void postConstruct() {
    this.builder.serializers(new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
    //Will not be needed anymore with SB 1.4 (Jackson > 2.7.1)
    this.builder.deserializerByType(LocalDate.class, new LocalDateDeserializer(ISO_DATE_OPTIONAL_TIME));
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:7,代码来源:JacksonConfiguration.java


示例3: JavaTimeModule

import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; //导入依赖的package包/类
public JavaTimeModule()
{
    super(PackageVersion.VERSION);

    // First deserializers

    // // Instant variants:
    addDeserializer(Instant.class, InstantDeserializer.INSTANT);
    addDeserializer(OffsetDateTime.class, InstantDeserializer.OFFSET_DATE_TIME);
    addDeserializer(ZonedDateTime.class, InstantDeserializer.ZONED_DATE_TIME);

    // // Other deserializers
    addDeserializer(Duration.class, DurationDeserializer.INSTANCE);
    addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
    addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE);
    addDeserializer(LocalTime.class, LocalTimeDeserializer.INSTANCE);
    addDeserializer(MonthDay.class, MonthDayDeserializer.INSTANCE);
    addDeserializer(OffsetTime.class, OffsetTimeDeserializer.INSTANCE);
    addDeserializer(Period.class, JSR310StringParsableDeserializer.PERIOD);
    addDeserializer(Year.class, YearDeserializer.INSTANCE);
    addDeserializer(YearMonth.class, YearMonthDeserializer.INSTANCE);
    addDeserializer(ZoneId.class, JSR310StringParsableDeserializer.ZONE_ID);
    addDeserializer(ZoneOffset.class, JSR310StringParsableDeserializer.ZONE_OFFSET);

    
    // then serializers:
    addSerializer(Duration.class, DurationSerializer.INSTANCE);
    addSerializer(Instant.class, InstantSerializer.INSTANCE);
    addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE);
    addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE);
    addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE);
    addSerializer(MonthDay.class, MonthDaySerializer.INSTANCE);
    addSerializer(OffsetDateTime.class, OffsetDateTimeSerializer.INSTANCE);
    addSerializer(OffsetTime.class, OffsetTimeSerializer.INSTANCE);
    addSerializer(Period.class, new ToStringSerializer(Period.class));
    addSerializer(Year.class, YearSerializer.INSTANCE);
    addSerializer(YearMonth.class, YearMonthSerializer.INSTANCE);

    /* 27-Jun-2015, tatu: This is the real difference from the old
     *  {@link JSR310Module}: default is to produce ISO-8601 compatible
     *  serialization with timezone offset only, not timezone id.
     *  But this is configurable.
     */
    addSerializer(ZonedDateTime.class, ZonedDateTimeSerializer.INSTANCE);
    
    // note: actual concrete type is `ZoneRegion`, but that's not visible:
    addSerializer(ZoneId.class, new ToStringSerializer(ZoneId.class));

    addSerializer(ZoneOffset.class, new ToStringSerializer(ZoneOffset.class));

    // key serializers
    addKeySerializer(ZonedDateTime.class, ZonedDateTimeKeySerializer.INSTANCE);

    // key deserializers
    addKeyDeserializer(Duration.class, DurationKeyDeserializer.INSTANCE);
    addKeyDeserializer(Instant.class, InstantKeyDeserializer.INSTANCE);
    addKeyDeserializer(LocalDateTime.class, LocalDateTimeKeyDeserializer.INSTANCE);
    addKeyDeserializer(LocalDate.class, LocalDateKeyDeserializer.INSTANCE);
    addKeyDeserializer(LocalTime.class, LocalTimeKeyDeserializer.INSTANCE);
    addKeyDeserializer(MonthDay.class, MonthDayKeyDeserializer.INSTANCE);
    addKeyDeserializer(OffsetDateTime.class, OffsetDateTimeKeyDeserializer.INSTANCE);
    addKeyDeserializer(OffsetTime.class, OffsetTimeKeyDeserializer.INSTANCE);
    addKeyDeserializer(Period.class, PeriodKeyDeserializer.INSTANCE);
    addKeyDeserializer(Year.class, YearKeyDeserializer.INSTANCE);
    addKeyDeserializer(YearMonth.class, YearMothKeyDeserializer.INSTANCE);
    addKeyDeserializer(ZonedDateTime.class, ZonedDateTimeKeyDeserializer.INSTANCE);
    addKeyDeserializer(ZoneId.class, ZoneIdKeyDeserializer.INSTANCE);
    addKeyDeserializer(ZoneOffset.class, ZoneOffsetKeyDeserializer.INSTANCE);
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:70,代码来源:JavaTimeModule.java


示例4: deserializeWith

import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; //导入依赖的package包/类
private LocalDate deserializeWith(String json, DateTimeFormatter f) throws Exception {
    ObjectMapper mapper = new ObjectMapper().registerModule(new SimpleModule()
        .addDeserializer(LocalDate.class, new LocalDateDeserializer(f)));
    return mapper.readValue("\"" + json + "\"", LocalDate.class);
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:6,代码来源:TestLocalDateSerializationWithCustomFormatter.java


示例5: setSince

import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; //导入依赖的package包/类
@JsonDeserialize(using = LocalDateDeserializer.class)
public void setSince(LocalDate since) {
  this.since = since;
}
 
开发者ID:HuygensING,项目名称:antioch,代码行数:5,代码来源:StatePojo.java



注:本文中的com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntoSet类代码示例发布时间:2022-05-22
下一篇:
Java JSTokenTypes类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap