1
我有以下類型片段造型上organisationunit自相關聯的WSDL:的wsimport產生意想不到的其餘代碼
...<xs:complexType name="OrganisationUnitBIAssocType">
<xs:complexContent>
<xs:extension base = "tns:OrgUnitBIType">
<xs:sequence>
<xs:element name ="ParentUnit" minOccurs="0" type="tns:OrgUnitBIType"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="OrgUnitBIType">
<xs:complexContent>
<xs:extension base="tns:refableWebServiceParameterType">
<xs:sequence>
<xs:element name="Oid" type="xs:long"/>
<xs:element name="NAme" type="xs:String"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>...
wsimport工具生成以下兩個Java類的organisationunit和協會:
@XmlAccessorType(XmlAccessType.Field)
@XmlType(name = "OrgUnitBIType", porpOrder = {"rest"})
@XmlSeeAlso({OrganisationUnitBIAssocType.class})
public class OrgUnitBIType extends RefableWebServiceParameterType
{
@XmlElementRefs({
@XmlElementRefs(name = "Name", type =JAXBElement.class, required = false),
@XmlElementRefs(name = "Oid", type =JAXBElement.class, required = false)
})
protected List<JAXBElement<? extends Serializable>> rest;
if(rest == null) {`
rest = new ArrayList<JAXBElement<? extends Serializable>>();`
}
return this.rest;`
}
}
@XmlAccessorType(XmlAccessType.Field)
@XmlType(name = "OrganisationUnitBIAssocType", porpOrder = {"rest"})
public class OrganisationUnitBIAssocType extends OrgUnitBIType {}
我想知道爲什麼會出現這些JAXBElements。我更喜歡具有 getter和setter的代碼,而不使用getRest方法的JAX-WS風格。
有沒有人知道如何實現這一目標?