All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.json.LocalTimeSerializer Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
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.LocalTime;
import java.time.format.DateTimeFormatter;

final class LocalTimeSerializer extends StdScalarSerializer {
    static final long serialVersionUID = 0L;

    public LocalTimeSerializer() {
        super(LocalTime.class);
    }

    @Override
    public void serialize(LocalTime value, JsonGenerator gen, SerializerProvider arg2) throws IOException {
        gen.writeString(DateTimeFormatter.ISO_TIME.format(value));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy