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

net.anotheria.anodoc.util.mapper.ps.FloatPropertySerializer Maven / Gradle / Ivy

package net.anotheria.anodoc.util.mapper.ps;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import net.anotheria.anodoc.data.FloatProperty;

import java.io.IOException;

/**
 * @author ykalapusha
 */
public class FloatPropertySerializer extends StdSerializer{

    public FloatPropertySerializer() {
        this(null);
    }

    public FloatPropertySerializer(Class t) {
        super(t);
    }

    @Override
    public void serialize(FloatProperty value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
        jgen.writeStartObject();
        jgen.writeStringField("id", value.getId());
        jgen.writeNumberField("value", value.getfloat());
        jgen.writeStringField("type", value.getPropertyType().toString());
        jgen.writeEndObject();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy