com.sportradar.mts.sdk.api.utils.MtsDateSerializer Maven / Gradle / Ivy
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.mts.sdk.api.utils;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.util.Date;
public class MtsDateSerializer extends JsonSerializer {
@Override
public void serialize(Date value, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException {
jsonGenerator.writeString(value == null ? null : MtsDateFormatter.get().format(value.getTime()));
}
}