LocalDateKeyDeserializer.java
package tools.jackson.databind.ext.javatime.deser.key;
import java.time.DateTimeException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.DeserializationContext;
public class LocalDateKeyDeserializer extends Jsr310KeyDeserializer {
public static final LocalDateKeyDeserializer INSTANCE = new LocalDateKeyDeserializer();
private LocalDateKeyDeserializer() {
// singleton
}
@Override
protected LocalDate deserialize(String key, DeserializationContext ctxt)
throws JacksonException
{
try {
return LocalDate.parse(key, DateTimeFormatter.ISO_LOCAL_DATE);
} catch (DateTimeException e) {
return _handleDateTimeException(ctxt, LocalDate.class, e, key);
}
}
}