com.ppiech.auto.value.jackson.internal.objectmappers.FloatMapper Maven / Gradle / Ivy
package com.ppiech.auto.value.jackson.internal.objectmappers;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import java.io.IOException;
/**
* Built-in mapper for Float objects
*/
public class FloatMapper extends com.ppiech.auto.value.jackson.JsonMapper {
@Override
public Float parse(JsonParser jsonParser) throws IOException {
if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
return null;
} else {
return jsonParser.getFloatValue();
}
}
@Override
public void parseField(Float instance, String fieldName, JsonParser jsonParser) throws IOException { }
@Override
public void serialize(Float object, JsonGenerator generator, boolean writeStartAndEnd) throws IOException {
generator.writeNumber(object);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy