com.targomo.client.api.json.TransitTravelTimeValueDeserializer 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.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.targomo.client.api.pojo.TransitTravelTimeValue;
import java.io.IOException;
public class TransitTravelTimeValueDeserializer extends JsonDeserializer {
public TransitTravelTimeValueDeserializer() {}
@Override
public TransitTravelTimeValue deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException {
JsonNode arrayValues = jsonParser.getCodec().readTree(jsonParser);
return TransitTravelTimeValue.builder()
.departure(arrayValues.get(0).asLong())
.arrival(arrayValues.get(1).asLong())
.build();
}
}