JAXB @XmlAdapter: Map -> List adapter? (marshall only)
I have a Map<String, String> . The first idea everyone has is to convert it to a List<Pair<String,String>> ( Pair being a custom class). I've tried a @XmlAdapter like this: public class MapPropertiesAdapter extends XmlAdapter<List<Property>, Map<String,String>> { ... } But Eclipse MOXy, the JAXB impl I use, ended up with a ClassCastException - "can't convert HashMap to Collection". Is this conversion supported by JAXB? Or did I overlook some documentation part which explains why it isn't? PS: I wanted to get XML like this: <properties> <property name="protocol"/> <property name="marshaller"/>