package com.fasterxml.jackson.module.jaxb.adapters; import javax.xml.bind.annotation.adapters.XmlAdapter; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class MapAdapter extends XmlAdapter, Map> { @Override public MapType marshal(Map v) throws Exception { final List> theEntries = new LinkedList>(); for (final Map.Entry anEntry : v.entrySet()) { theEntries.add(new EntryType(anEntry.getKey(), anEntry.getValue())); } return new MapType(theEntries); } @Override public Map unmarshal(MapType v) throws Exception { final Map theMap = new HashMap(); for (final EntryType anEntry : v.getEntries()) { theMap.put(anEntry.getKey(), anEntry.getValue()); } return theMap; } }