com.sportradar.mts.sdk.api.utils.BooleanToIntegerConverter 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;
public class BooleanToIntegerConverter extends JsonSerializer {
@Override
public void serialize(Boolean value, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException {
if (value != null) {
jsonGenerator.writeNumber(value ? 1 : 0);
}
}
}