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

org.opentripplanner.api.adapters.MapAdapter Maven / Gradle / Ivy

package org.opentripplanner.api.adapters;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import javax.xml.bind.annotation.adapters.XmlAdapter;

public class MapAdapter extends XmlAdapter> {

    @Override
    public MapType marshal(Map v) throws Exception {
        MapType MapType = new MapType();
        List aList = MapType.getEntry();
        for (Map.Entry e : v.entrySet()) {
            aList.add(new Entry(e.getKey(), e.getValue()));
        }
        return MapType;
    }

    @Override
    public Map unmarshal(MapType v) throws Exception {
        Map map = new TreeMap();
        for (Entry e : v.getEntry()) {
            map.put(e.key, e.value);
        }
        return map;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy