com.fasterxml.jackson.jr.extension.javatime.LocalDateTimeValueReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-jr-extension-javatime Show documentation
Show all versions of jackson-jr-extension-javatime Show documentation
Jackson-jr extension that adds support for Java 8 Date/Time value types such as `java.time.LocalDateTime`
package com.fasterxml.jackson.jr.extension.javatime;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.jr.ob.api.ValueReader;
import com.fasterxml.jackson.jr.ob.impl.JSONReader;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LocalDateTimeValueReader extends ValueReader {
private final DateTimeFormatter formatter;
public LocalDateTimeValueReader(DateTimeFormatter formatter) {
super(LocalDateTime.class);
this.formatter = formatter;
}
@Override
public Object read(JSONReader reader, JsonParser p) throws IOException {
return LocalDateTime.parse(p.getText(), formatter);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy