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

com.graphhopper.jackson.CmdArgsDeserializer Maven / Gradle / Ivy

package com.graphhopper.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.graphhopper.util.CmdArgs;

import java.io.IOException;
import java.util.Map;

public class CmdArgsDeserializer extends JsonDeserializer {

    private static final TypeReference> MAP_STRING_STRING
            = new TypeReference>() {};

    @Override
    public CmdArgs deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
        jsonParser.setCodec(new ObjectMapper());
        Map args = jsonParser.readValueAs(MAP_STRING_STRING);
        return new CmdArgs(args);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy