io.github.dft.shipster.common.LocalDateTimeDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shipster Show documentation
Show all versions of shipster Show documentation
shipster API using JDK 11
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);
}
}