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

net.guerlab.commons.time.jackson.deserializer.LocalDateTimeDeserializer Maven / Gradle / Ivy

Go to download

net.guerlab.commons is a suite of core and expanded libraries that include utility classes and much much more.

The newest version!
/*
 * Copyright 2018-2021 guerlab.net and other contributors.
 *
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.guerlab.commons.time.jackson.deserializer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import net.guerlab.commons.time.TimeHelper;

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

/**
 * 日期时间反序列化处理
 *
 * @author guer
 */
public class LocalDateTimeDeserializer extends JsonDeserializer {

    @Override
    public LocalDateTime deserialize(JsonParser jp, DeserializationContext context) throws IOException {
        return TimeHelper.parseLocalDateTime(jp.getValueAsString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy