Jaxb namespaces for java.util.Map properties

。_饼干妹妹 提交于 2019-12-05 20:03:55

You could use an XmlAdapter with you java.util.Map property to get the namespace qualification you are looking for.

For an example of using XmlAdapter with java.uti.Map see:

For more info on JAXB and namespaces :


FYI

I am considering adding an extension to EclipseLink JAXB (MOXy) to better handle this scenario:

@XmlMap(wrapper="my-entry", key="@my-key", value="my-value")
public Map<String, PhoneNumber> phoneNumbers = new HashMap<String, PhoneNumber>(); 

The above annotation would correspond to the following XML:

<phoneNumbers>
    <my-entry my-key="work">
        <my-value>613-555-1111</value>
    </my-entry>
</phoneNumbers>

The key/value properties would be XPath statements, and the namespace information would follow what is done for other MOXy extensions (for an example see link below):

Enhancement Request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!