例如:
<xsd:complexType name="Strategy"> <xsd:sequence> <xsd:element name="networks" type="xsd:string" minOccurs="0" maxOccurs="100" /> </xsd:sequence> </xsd:complexType>
生成的java对象里只有get函数:
/** * Gets the value of the networks property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the networks property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNetworks().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Network } * * */ public List<String> getNetworks() { if (networks == null) { networks = new ArrayList<String>(); } return this.networks; }
没有set函数,但是正如get函数的注释所示,使用方法是通过
getNetworks().add(newItem);