Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Specifying Collection Type in OXM

I propose that both levels be allowed:

<xml-element java-attribute="zipCodes" type="java.lang.Integer" collection-type="java.util.List"/>
and
<xml-element java-attribute="zipCodes" type="java.lang.Integer" collection-type="java.util.ArrayList"/>

-Blaise

Michael Norman wrote:
Is the intent of the collection-type to only specify the collection's API interface class (List instead of ArrayList, Map instead of HashMap)
or would concrete impls be allowed? or custom collection classes?

----- Original Message -----
From: rick.barkhouse@xxxxxxxxxx
To: eclipselink-dev@xxxxxxxxxxx
Sent: Thursday, August 26, 2010 12:04:47 PM GMT -05:00 US/Canada Eastern
Subject: [eclipselink-dev] Specifying Collection Type in OXM

Hi all,

In EclipseLink OXM we currently have the ability to specify the Java type of an element, attribute, etc., but there is no way to specify what Collection type (if any) is being used.  For example, the following is currently supported:
Java: private java.lang.Integer zipCode;
OXM:  <xml-element java-attribute="zipCode" type="java.lang.Integer"/>
  

But the following is not:
Java: private java.util.List<java.lang.Integer> zipCodes;

This is needed for Dynamic JAXB -- because there is no Java class behind the scenes, we must depend exclusively on the OXM for all of the necessary information in order to build the dynamic type.

Dave M has put together a wiki page for this issue at:

http://wiki.eclipse.org/EclipseLink/DesignDocs/322284

I think the only real point of contention would be what we call this attribute.  JPA uses "attribute-type", but we feel this would be confusing as we already have an attribute called "type".  I would propose that we add a "collection-type" attribute to the following OXM tags:

<xml-element>
<xml-elements>
<xml-any-element>

e.g.
<xml-element java-attribute="zipCodes" type="java.lang.Integer" collection-type="java.util.List"/>

Thoughts?

--
Rick Barkhouse | Software Developer, EclipseLink | 613.288.4613
Oracle Development
45 O'Connor Street, Suite 400 | Ottawa, Ontario K1P 1A4

_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

Back to the top