#17 Serialization implemented
This commit is contained in:
parent
a87f3da9d2
commit
afac3ba855
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -34,7 +35,10 @@ public class JsonTaskDatabase implements TaskDatabase{
|
||||||
static {
|
static {
|
||||||
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
LocalDateDeserializer dateDeserializer = new LocalDateDeserializer(dateFormat);
|
LocalDateDeserializer dateDeserializer = new LocalDateDeserializer(dateFormat);
|
||||||
|
LocalDateSerializer dateSerializer = new LocalDateSerializer(dateFormat);
|
||||||
|
|
||||||
timeModule.addDeserializer(LocalDate.class, dateDeserializer);
|
timeModule.addDeserializer(LocalDate.class, dateDeserializer);
|
||||||
|
timeModule.addSerializer(LocalDate.class, dateSerializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue