Hi Friends,
I was unable to use simple JAXB objects via gosu ,
I generated jaxb client jar for an XSD via Ant job and then imported in gosu,
Rather posting the whole xsd , would like to post the snippets..
XSD Below
----------
...
...
<xsd:element name="CreateRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RequestSpecification" type="RequestSpecification" minOccurs="0"/>
<xsd:element name="creatorUserIDSpecification" type="UserIDSpecification" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>...
<xsd:complexType name="RequestSpecification">
<xsd:sequence>
<xsd:element name="InternalAssignees" type="ArrayOfUserIDSpecification" minOccurs="0"/>
<xsd:element name="WritingCompanySpecification" type="WritingCompanySpecification" minOccurs="0"/>
<xsd:element name="Coverages" type="ArrayOfClaimCoverage" minOccurs="0"/>
...
... </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfClaimCoverage">
<xsd:sequence>
<xsd:element name="ClaimCoverage" type="ClaimCoverage" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
---------------------------------------------
Jaxb Generated method for ArrayOfClaimCoverage in ArrayOfClaimCoverage.java
-----------------------------------------------------------------
public class ArrayOfClaimCoverage
implements Cloneable, CopyTo, Equals, HashCode, MergeFrom, ToString
{
@XmlElement(name = "ClaimCoverage", nillable = true)
protected List<ClaimCoverage> claimCoverage;
/**
* Gets the value of the claimCoverage 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 claimCoverage property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getClaimCoverage().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
*
{@link ClaimCoverage }
*
*
*/
public List<ClaimCoverage> getClaimCoverage() {
if (claimCoverage == null) {
claimCoverage = new ArrayList<ClaimCoverage>();
}
return this.claimCoverage;
}
----
Gosu Code
------------
var arrayOfClaimCoverages1 = new ArrayOfClaimCoverage()
var covList = arrayOfClaimCoverages1.getClaimCoverage()
covList.add(0, new ClaimCoverage())
covList.add(1, new ClaimCoverage())
arrayOfClaimCoverages1.getClaimCoverage().addAll( covList)
// getClaimCoverage().add(newItem); using the same syntax as given by JAXB
arrayOfClaimCoverages1.getClaimCoverage().add( new ClaimCoverage() )
arrayOfClaimCoverages1.getClaimCoverage().add( new ClaimCoverage() )
print(arrayOfClaimCoverages1.getClaimCoverage().size)
----------
Prints 0 , Where as doing the same on Java return 4
Tried all the possible ways , but could not figure out what is wrong via gosu code... has any one faced the similar issue..?
Thanks and Regards,
Abhijith Rao