users@jaxb.java.net

Re: Set instead of List?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sat, 10 Dec 2011 06:14:38 +0100

This does not work, and it is contrary to the JAXB Specification, where
it says that collectionType. if specified, must be either “indexed" or
any fully qualified class name that implements java.util.List. java.util.Set
does neither.

xjc compiles, but the generated Java code is broken:
   protected List<FooType> foo = new Set<FooType>();

-W

On 09/12/2011, Farrukh Najmi <farrukh_at_wellfleetsoftware.com> wrote:
> Try customizations in attached file. Note I have not actually tried it
> and you may need to tweek. You should rename it to bindings.xjb per
> default conventions.
>
> On 12/09/2011 11:01 AM, John G. Lussmyer wrote:
>> Well, those docs do seem to imply it's possible, but darned if I can
>> figure out the syntax needed.
>>
>> What I have is a <xs:complexType> that contains multiple elements.
>> One element is:
>> <xs:sequence>
>> <xs:element name="ConsumerIdentifier" type="ConsumerIdentifier"
>> minOccurs="1" maxOccurs="unbounded"/>
>> </xs:sequence>
>> What I want is for the get/setConsumerIdentifier() methods to use
>> Set<ConsumerIdentifier> instead of List<ConsumerIdentifier>.
>>
>> Any suggestions on xsd syntax needed?
>>
>>
>> On 12/9/2011 4:17 AM, Farrukh Najmi wrote:
>>> On 12/08/2011 12:23 PM, cougar_at_casadelgato.com wrote:
>>>> Is there any way to have the xsd defined java objects have a Set
>>>> instead of a List?
>>>>
>>> You need to use a jaxb |collectionType |customization either globally
>>> or for a specific property binding:
>>>
>>> http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html
>>>
>
> --
> Regards,
> Farrukh Najmi
>
> Web: http://www.wellfleetsoftware.com
>
>
>