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

io.github.dft.shipster.common.LocalDateTimeDeserializer Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package io.github.dft.shipster.common;

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

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LocalDateTimeDeserializer extends JsonDeserializer {

    @Override
    @SneakyThrows
    public LocalDateTime deserialize(JsonParser parser, DeserializationContext context) {
        String dateStr = parser.getText();
        return LocalDateTime.parse(dateStr, DateTimeFormatter.ISO_DATE_TIME);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy