本文主要是介绍xsd生成的java对象里的list成员变量没有set函数,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
例如:
<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);
这篇关于xsd生成的java对象里的list成员变量没有set函数的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!