我有这个简单的对象:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class SimilarityInfoResult {
private String name;
private List<String[]> parameters;
public SimilarityInfoResult() {
}
public SimilarityInfoResult(String name, List<String[]> parameters) {
this.name = name;
this.parameters = parameters;
}
...
}
它被映射为:
<similarityInfoResult>
<name>SubstructureSimilarity</name>
<parameters>
<item>treshold</item>
<item>Double</item>
</parameters>
<parameters>
<item>numberOfResults</item>
<item>Integer</item>
</parameters>
</similarityInfoResult>
期望的输出:
<similarityInfoResult>
<name>SubstructureSimilarity</name>
<parameters>
<parameter>
<name>treshold</name>
<type>Double</type>
</parameter>
<parameter>
<name>results</name>
<type>Integer</type>
</parameter>
</parameters>
</similarityInfoResult>
我应该如何使用注释来做到这一点?可能吗?也许我将不得不制作特殊的参数对象和List<Parameter>
?谢谢