com.targomo.client.api.json.AbstractSourceMapSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java client library for easy usage of Targomo web services.
The newest version!
package com.targomo.client.api.json;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.targomo.client.api.geo.Location;
import java.io.IOException;
import static com.targomo.client.api.util.SerializationUtil.travelTypeListToJsonGenerator;
/**
* Created by Gideon Cohen
*/
public abstract class AbstractSourceMapSerializer extends JsonSerializer {
public void writeExtraData(Location location, JsonGenerator jsonGenerator) throws IOException {
travelTypeListToJsonGenerator(location.getTravelTypes(), jsonGenerator, "travelTypes", "travelType");
if( location.getProperties() != null) {
jsonGenerator.writeFieldName("aggregationInputParameters");
jsonGenerator.writeStartObject();
if (location.getProperties().getInputFactor() != null) {
jsonGenerator.writeNumberField("inputFactor", location.getProperties().getInputFactor());
}
if (location.getProperties().getGravitationAttractionStrength() != null) {
jsonGenerator.writeNumberField("gravitationAttractionStrength", location.getProperties().getGravitationAttractionStrength());
}
if (location.getProperties().getGravitationPositiveInfluence() != null) {
jsonGenerator.writeBooleanField("gravitationPositiveInfluence", location.getProperties().getGravitationPositiveInfluence());
}
jsonGenerator.writeEndObject();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy