AW: AW: clone list
Brought to you by:
chanscte,
schulte2005
From: Schuster, A. <ale...@ca...> - 2010-05-12 10:39:22
|
It seems as if attachments are not accepted so I paste the important files in the email: XSD: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://myNamespace.myCompany.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://myNamespace.myCompany.com"> <xsd:complexType name="TypeA"> <xsd:sequence> <xsd:element name="typeB" type="tns:TypeB" minOccurs="0"/> <xsd:element name="typeCs" type="tns:TypeCs"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TypeB"> <xsd:sequence> <xsd:element name="a" type="xsd:string" minOccurs="0"/> <xsd:element name="b" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TypeCs"> <xsd:sequence> <xsd:element name="member" type="tns:TypeC" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TypeC"> <xsd:sequence> <xsd:element name="a" type="xsd:string" minOccurs="0"/> <xsd:element name="b" type="xsd:long" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:schema> Generated-Class TypeA: public class TypeA implements Cloneable { protected TypeB typeB; @XmlElementWrapper(name = "typeCs") @XmlElement(name = "member") protected List<TypeC> typeCs = new ArrayList<TypeC>(); /** * Creates a new {@code TypeA} instance. * */ public TypeA() { // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 super(); } /** * Creates a new {@code TypeA} instance by deeply copying a given {@code TypeA} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public TypeA(final TypeA o) { // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'TypeA' from 'null'."); } // CClassInfo: com.mycompany.mynamespace.TypeB this.typeB = ((o.getTypeB() == null)?null:o.getTypeB().clone()); // CClassInfo: com.mycompany.mynamespace.TypeCs this.typeCs = ((o.getTypeCs() == null)?null:o.getTypeCs().clone()); } /** * Gets the value of the typeB property. * * @return * possible object is * {@link TypeB } * */ public TypeB getTypeB() { return typeB; } /** * Sets the value of the typeB property. * * @param value * allowed object is * {@link TypeB } * */ public void setTypeB(TypeB value) { this.typeB = value; } public List<TypeC> getTypeCs() { return typeCs; } /** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public TypeA clone() { // CC-XJC Version 1.3 Build 2010-02-27T15:04:03+0000 return new TypeA(this); } } -----Ursprüngliche Nachricht----- Von: Schuster, Alexander [mailto:ale...@ca...] Gesendet: Mittwoch, 12. Mai 2010 12:35 An: CC-XJC Users Betreff: AW: AW: clone list Attachment 2nd try -----Ursprüngliche Nachricht----- Von: Schuster, Alexander [mailto:ale...@ca...] Gesendet: Mittwoch, 12. Mai 2010 12:31 An: CC-XJC Users Betreff: AW: AW: clone list Hi Christian, thanks for your fast response. I created an example in order to be able to comprehend the problem. The according .xsd as well as the generated classes are attached to this e-mail. During compilation the following error occurs: target\generated-sources\xjc\com\mycompany\mynamespace\TypeA.java:[80,65] cannot find symbol symbol : method clone() location: interface java.util.List<com.mycompany.mynamespace.TypeC> Thank you very much for any assistance Alex -----Ursprüngliche Nachricht----- Von: Christian Schulte [mailto:sch...@us...] Gesendet: Montag, 10. Mai 2010 23:19 An: CC-XJC Users Betreff: Re: AW: clone list Schuster, Alexander schrieb: > > For the member > protected List<DeviceInformation> members = new > ArrayList<DeviceInformation>(); > > the plugin generates the following line in the copy-constructor > this.members = ((o.getMembers() == null)?null:o.getMembers().clone()); > > with the help of the method > public List<DeviceInformation> getMembers() { > return members; > } > Could you please provide a schema(fragment) used to produce that code ? -- Christian ------------------------------------------------------------------------------ _______________________________________________ ccxjc-users mailing list ccx...@li... https://lists.sourceforge.net/lists/listinfo/ccxjc-users ------------------------------------------------------------------------------ _______________________________________________ ccxjc-users mailing list ccx...@li... https://lists.sourceforge.net/lists/listinfo/ccxjc-users |