public class MapXmlPropertyDefConfigAdapter extends XmlAdapter<MapXmlPropertyDefConfigAdapter.ListProperty,Map<String,XmlPropertyDefConfig>>
XmlNodeConfig
to a simple list parameters in the XML file since JAXB does not directly
support Map's, but mostly so that properties can be expressed with simple
parameters.
By "simple parameters" we mean something convenient like this:
<A_PROPERTY>a_value</A_PROPERTY>
instead of the more strict and verbose:
<property>
<name>A_PROPERTY</name>
<value>a_value</value>
</property>
or:
<property name="A_PROPERTY" value="a_value"/>
Note that this makes specifying the indOnlyThisChild property of the
XmlPropertyDefConfig more awkward, but nevertheless supported using an
attribute:
<A_PROPERTY ind-only-this-node="true">a_value</A_PROPERTY>
| Modifier and Type | Class and Description |
|---|---|
static class |
MapXmlPropertyDefConfigAdapter.ListProperty
We need to introduce a class for wrapping the List of JAXBElement's, else JAXB
does not know what to do with the List itself.
|
| Constructor and Description |
|---|
MapXmlPropertyDefConfigAdapter() |
| Modifier and Type | Method and Description |
|---|---|
MapXmlPropertyDefConfigAdapter.ListProperty |
marshal(Map<String,XmlPropertyDefConfig> mapPropertyDefConfigXml)
TODO:
This method is not really useful for now since modification of
XmlConfig is not currently supported. |
Map<String,XmlPropertyDefConfig> |
unmarshal(MapXmlPropertyDefConfigAdapter.ListProperty listProperty) |
public MapXmlPropertyDefConfigAdapter.ListProperty marshal(Map<String,XmlPropertyDefConfig> mapPropertyDefConfigXml)
XmlConfig is not currently supported.
In fact this method is incomplete as it does not support the indOnlyThisNode property which must be marshalled as an attribute of the property.
I believe the solution revolves around:
marshal in class XmlAdapter<MapXmlPropertyDefConfigAdapter.ListProperty,Map<String,XmlPropertyDefConfig>>public Map<String,XmlPropertyDefConfig> unmarshal(MapXmlPropertyDefConfigAdapter.ListProperty listProperty)
unmarshal in class XmlAdapter<MapXmlPropertyDefConfigAdapter.ListProperty,Map<String,XmlPropertyDefConfig>>Copyright © 2015–2016 AZYVA INC.. All rights reserved.