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

com.targomo.client.api.json.TransitTravelTimeValueDeserializer Maven / Gradle / Ivy

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();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy