You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Suneet Shah <su...@gmail.com> on 2008/06/15 14:49:02 UTC
CXF Support for Java Collections
Hello:
Where can I find more details on CXF's support for Java Collections. I have
a set of POJO's whose interfaces use Lists and Sets. I am wondering if need
to create an additional layer that expose these as Arrays or if can be
handled as is.
thanks
Suneet
Re: CXF Support for Java Collections
Posted by Daniel Kulp <dk...@apache.org>.
On Jun 15, 2008, at 11:12 PM, Martijn Brinkers (List) wrote:
> Are you sure Set is not supported?
>
> See:
> https://issues.apache.org/jira/browse/CXF-1558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
I think you can send/return a Set as internally, JAXB just sees a
collection. However, I don't think you can receive a set. When
JAXB constructs a collection, it always creates an ArrayList.
I'm not 100% positive on that though.
Acutally, it MIGHT work with wrapper types. Normally, JAXB types
would have an instance of the collection created internally and JAXB
just accesses it like:
obj.getFoo().add(foo)
so if getFoo() returns the Set, it should work. However, I'm not
sure if that works with the internal generated wrapper types or not
though. For those, we normally just use getter/setters and thus
would use the collection (ArrayList) that JAXB would create by default.
Dan
>
>
> Martijn Brinkers
>
> On Sun, 2008-06-15 at 22:38 -0400, Daniel Kulp wrote:
>>
>> Lists should work fine. JAXB supports them without problems at all.
>> Sets are another matter. JAXB doesn't support those directly.
>> Thus, for those, you would need to write a type adapter and use the
>> @XmlJavaTypeAdapter annotation. The java_first_jaxws has an example
>> that uses the type adapters to map a Map as well as interfaces.
>>
>> Dan
>>
>>
>>
>> On Jun 15, 2008, at 8:49 AM, Suneet Shah wrote:
>>
>>> Hello:
>>>
>>> Where can I find more details on CXF's support for Java Collections.
>>> I have
>>> a set of POJO's whose interfaces use Lists and Sets. I am wondering
>>> if need
>>> to create an additional layer that expose these as Arrays or if
>>> can be
>>> handled as is.
>>>
>>> thanks
>>> Suneet
>>
>> ---
>> Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>>
>>
>>
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: CXF Support for Java Collections
Posted by "Martijn Brinkers (List)" <ma...@gmail.com>.
Are you sure Set is not supported?
See:
https://issues.apache.org/jira/browse/CXF-1558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
Martijn Brinkers
On Sun, 2008-06-15 at 22:38 -0400, Daniel Kulp wrote:
>
> Lists should work fine. JAXB supports them without problems at all.
> Sets are another matter. JAXB doesn't support those directly.
> Thus, for those, you would need to write a type adapter and use the
> @XmlJavaTypeAdapter annotation. The java_first_jaxws has an example
> that uses the type adapters to map a Map as well as interfaces.
>
> Dan
>
>
>
> On Jun 15, 2008, at 8:49 AM, Suneet Shah wrote:
>
> > Hello:
> >
> > Where can I find more details on CXF's support for Java Collections.
> > I have
> > a set of POJO's whose interfaces use Lists and Sets. I am wondering
> > if need
> > to create an additional layer that expose these as Arrays or if can be
> > handled as is.
> >
> > thanks
> > Suneet
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>
Re: CXF Support for Java Collections
Posted by Daniel Kulp <dk...@apache.org>.
Lists should work fine. JAXB supports them without problems at all.
Sets are another matter. JAXB doesn't support those directly.
Thus, for those, you would need to write a type adapter and use the
@XmlJavaTypeAdapter annotation. The java_first_jaxws has an example
that uses the type adapters to map a Map as well as interfaces.
Dan
On Jun 15, 2008, at 8:49 AM, Suneet Shah wrote:
> Hello:
>
> Where can I find more details on CXF's support for Java Collections.
> I have
> a set of POJO's whose interfaces use Lists and Sets. I am wondering
> if need
> to create an additional layer that expose these as Arrays or if can be
> handled as is.
>
> thanks
> Suneet
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog