Strange Behaviour of Gosu while acessing and using JAXB generated Objects

144 views
Skip to first unread message

Abhijith Rao

unread,
Mar 6, 2013, 11:17:56 AM3/6/13
to gosu...@googlegroups.com
 
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

 

Dana Lank

unread,
Mar 6, 2013, 11:34:05 AM3/6/13
to gosu...@googlegroups.com
Gosu has an XSD databinding built in, you just drop your XSD into your Gosu source directory. There are some additional steps to turn the XML subsystem on, that is documented here:

http://gosu-lang.org/doc/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Gosu%20Reference%20Guide/getting-started-gosu-opensource.04.4.html#1512731

There is an XML chapter in the official docs, and I'm happy to help with any issues you have via this mailing list.

Dana Lank



 

--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gosu-lang+...@googlegroups.com.
To post to this group, send email to gosu...@googlegroups.com.
Visit this group at http://groups.google.com/group/gosu-lang?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Abhijith Rao

unread,
Mar 6, 2013, 11:46:52 AM3/6/13
to gosu...@googlegroups.com
Hi Dana,
 
If I had a chance to use that gosu feature , would have done that happily :) , but (tied to )gotta use JAXB objects...
 
any solution or work around ? I am surprised arrayOfClaimCoverages1 instance shows zero elements, but at Java it works...
 
Regards,
Abhijith
     * {...@link ClaimCoverage }

Michael Wright

unread,
Mar 6, 2013, 12:16:55 PM3/6/13
to gosu...@googlegroups.com
Hi Abhijith,

   Which version of Gosu are you using? 

Regards,
Mike




 

--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gosu-lang+...@googlegroups.com.
To post to this group, send email to gosu...@googlegroups.com.
Visit this group at http://groups.google.com/group/gosu-lang?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Regards,
Mike

Abhijith Rao

unread,
Mar 7, 2013, 5:37:43 AM3/7/13
to gosu...@googlegroups.com
 
I found out it cannot it be done , its gscript what I am using not gosu ..
     * {...@link ClaimCoverage }



--
Regards,
Mike

Luca Boasso

unread,
Mar 7, 2013, 11:21:58 AM3/7/13
to gosu...@googlegroups.com
it is the same language.
Gscript was the internal code name

Luke

unread,
Mar 7, 2013, 11:42:23 AM3/7/13
to gosu...@googlegroups.com

This also suggests me that you are using the internal Guidewire Gosu.
Please, you should go through to the company's support channels if you have problems.
This Google groups is intended for users of the open source version and has nothing to do with Guidewire's products.
Reply all
Reply to author
Forward
0 new messages