pl.allegro.tech.hermes.api.jackson.OffsetDateTimeSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-api Show documentation
Show all versions of hermes-api Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.api.jackson;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.OffsetDateTime;
import static java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME;
public class OffsetDateTimeSerializer extends JsonSerializer {
@Override
public void serialize(OffsetDateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeString(ISO_OFFSET_DATE_TIME.format(value));
}
}