class MapAdapter extends XmlAdapter<ConfigProperties, Map<String, String>> {

    @Override
    public ConfigProperties marshal(Map<String, String> map) throws Exception {
        if (map == null) return null;

        ConfigProperties configProperties = new ConfigProperties();

        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();

            JAXBElement<String> element = new JAXBElement<>(new QName(key), String.class, value);

            configProperties.getProperties().add(element);
        }

        return configProperties;
    }

}