生成されたクラスをラップするには、classImplバインディングを使用しますが、生成されたクラスのコレクションは、classImplのタイプではなく、生成されたタイプを返します。もちろん、classImplのリストが必要です...
私のxsd:
<complexType name="A">
<xs:sequence>
<element name="listB" type="sbs:B" minOccurs="0" maxOccurs="unbounded"></element>
<element name="singleB" type="sbs:B" minOccurs="1" maxOccurs="1"></element>
</xs:sequence>
</complexType>
<complexType name="B">
<xs:annotation><xs:appinfo>
<jxb:class implClass="BWrapper" />
</xs:appinfo></xs:annotation>
</complexType>
生成されるクラスは次のとおりです。
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "A", propOrder = {
"listB",
"singleB"
})
public class A {
@XmlElement(type = BWrapper.class)
protected List<B> listB;
@XmlElement(required = true, type = BWrapper.class)
protected BWrapper singleB;
予想通り、singleBはBWrapperと入力されているので、なぜlistBがBWrapperのリストではなくBのリストであるのですか?
よろしくお願いします!!