All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.migoo.framework.jackson.databind.LocalDateTimeDeserializer Maven / Gradle / Ivy

The newest version!
package xyz.migoo.framework.jackson.databind;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

/**
 * * LocalDateTime反序列化规则
 * * 

* * 会将毫秒级时间戳反序列化为LocalDateTime * * @author xiaomi * Created on 2021/11/21 13:58 */ public class LocalDateTimeDeserializer extends JsonDeserializer { @Override public LocalDateTime deserialize(JsonParser p, DeserializationContext context) throws IOException { return LocalDateTime.ofInstant(Instant.ofEpochMilli(p.getValueAsLong()), ZoneId.systemDefault()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy