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

com.gooddata.util.BooleanIntegerSerializer Maven / Gradle / Ivy

There is a newer version: 3.11.1+api3
Show newest version
package com.gooddata.util;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * Serializes boolean as Integer 1 or 0
 */
public class BooleanIntegerSerializer extends JsonSerializer {

    @Override
    public void serialize(Boolean value, JsonGenerator gen, SerializerProvider arg2) throws IOException {
        gen.writeNumber(Boolean.TRUE.equals(value) ? 1 : 0);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy