哪个JAX-B注释类在两个表示之后实现 (与杰克逊的JacksonJaxbJsonProvider)?
JSON:
{"propertyList": [
{"key": "aKey", "value": "someValue"},
{"key": "anotherKey", "value": "someOtherValue"}
]}
XML:
<root>
<propertyList>
<property>
<key>aKey</key>
<value>someValue</value>
</property>
<property>
<key>anotherKey</key>
<value>someOtherValue</value>
</property>
</propertyList>
</root>
以下类实现JSON:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Root {
@XmlElement
private List<Property> propertyList;
}
@XmlAccessorType(XmlAccessType.FIELD)
public class Property {
@XmlElement
private String key;
@XmlElement
private String value;
}
以下类实现XML:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Root{
@XmlElementWrapper(name="propertyList")
@XmlElement(name="property")
private List<Property> propertyList;
}
是否存在两种表示的实现?或者有没有办法将@XmlElementWrapper与JSON一起使用?