Search in sources :

Example 1 with MapType

use of org.codehaus.jackson.map.type.MapType in project ovirt-engine by oVirt.

the class JsonHelper method jsonToMap.

public static Map<String, Object> jsonToMap(String jsonString) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    MapType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class);
    Map<String, Object> data = mapper.readValue(jsonString, type);
    return data;
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper) MapType(org.codehaus.jackson.map.type.MapType)

Example 2 with MapType

use of org.codehaus.jackson.map.type.MapType in project incubator-gobblin by apache.

the class KafkaCheckpoint method deserialize.

public static KafkaCheckpoint deserialize(InputStream inputStream) throws IOException {
    TypeFactory typeFactory = _mapper.getTypeFactory();
    MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Long.class);
    HashMap<Integer, Long> checkpoint = _mapper.readValue(inputStream, mapType);
    return new KafkaCheckpoint(checkpoint);
}
Also used : TypeFactory(org.codehaus.jackson.map.type.TypeFactory) MapType(org.codehaus.jackson.map.type.MapType)

Aggregations

MapType (org.codehaus.jackson.map.type.MapType)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 TypeFactory (org.codehaus.jackson.map.type.TypeFactory)1