4
我有這個簡單的目的:JAXB註釋 - 馬歇爾名單<String[]>
@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>
?謝謝