Dan is right.

I greped and found it's defined in the section 7.5.1

Just FYI here

basically you can do this

   <xsd:annotation>
   <xsd:appinfo>
       <jxb:globalBindings collectionType="indexed"/>
   </xsd:appinfo>
   </xsd:annotation>

Don't forget adding the jaxb namespace and jaxb:version

It still use the List form, but you get the method
>> public void setChoice(ChoiceType[] values)
And the previous method been protected
>>  protected List<ChoiceType> _getChoice()

You can also change the collectionType to "java.util.Vector", or any class implemented the java.util.List

James


If you really want the [] form instead of the collection form, JAXB does provide "customizations" that can be used when you run wsdltojava to produce what it calls "indexed" properties. I don't really remember how it's done, but grep for "indexed" in chapter 7 of the JAXB spec.

Dan


On Wednesday 27 June 2007 04:17, James Mao wrote:
Hi,

We delegate the types generation to JAXB2,
and in the generated types, they don't generate the setter for the
List types

You can do the following in Java

getChoice().add(new ChoiceType())


James

Hi guys, I'm fairly new to CXF and I've got a question regarding the
WSDL2Java tool:


I was using this WSDL snippet:

       <!-- ChoiceType -->
       <complexType name="ChoiceType">
           <sequence>
                   <element name="choiceId" type="string"/>
                   <element name="choice" type="string"/>
                   <element name="score" type="float"/>
           </sequence>
       </complexType>

       <!-- ChoiceList -->
       <complexType name="ChoiceList">
           <sequence>
               <element name="choice" type="type:ChoiceType"
minOccurs='0' maxOccurs='unbounded'/>
           </sequence>
       </complexType>

I ran the WSDL2Java tool using the maven plugin and I got both
/ChoiceList.class/ and /ChoiceList.java/ with the /getChoice()/
method but the /setChoice(ChoiceType) /was missing.
Any answers to why it was missing and some possible work around?

Thanks,
Ken

Reply via email to