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

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

The newest version!
package io.github.dft.mayers.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