io.sphere.sdk.json.LocalDateSerializer Maven / Gradle / Ivy
package io.sphere.sdk.json;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
final class LocalDateSerializer extends StdScalarSerializer {
static final long serialVersionUID = 0L;
public LocalDateSerializer() {
super(LocalDate.class);
}
@Override
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException {
gen.writeString(DateTimeFormatter.ISO_DATE.format(value));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy