| Summary: | [OXM] Need a way to specify Collection Type in an xml-element | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Rick Barkhouse <rick.barkhouse> | ||||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | enhancement | ||||||||||||
| Priority: | P3 | CC: | david.mccann, rick.barkhouse | ||||||||||
| Version: | unspecified | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | |||||||||||||
| Bug Blocks: | 321152 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Rick Barkhouse
The design Wiki for this issue can be found here: http://wiki.eclipse.org/EclipseLink/DesignDocs/322284 xml-list should not be assumed in this case. Consider this: when a collection property is annotated with @XmlElement, each item in the collection will be wrapped by an element. For example,
@XmlRootElement
class Foo {
@XmlElement
List<String> data;
}
would produce XML like this:
<foo>
<data>abc</data>
<data>def</data>
</foo>
@XmlList annotation, allows multiple values to be represented as whitespace-separated tokens in a single element. For example,
@XmlRootElement
class Foo {
@XmlElement
@XmlList
List<String> data;
}
would produce XML like this:
<foo>
<data>abc def</data>
</foo>
In JPA, an array type is declared using attribute-type as follows:
attribute-type="java.lang.Integer[]"
I propose we do the same thing, i.e.
collection-type="java.lang.Integer[]"
Created attachment 179867 [details]
Proposed fix.
Created attachment 179868 [details]
Supporting test cases
Created attachment 179876 [details]
Proposed fix.
Created attachment 179877 [details]
Supporting test cases
Arrays will not be supported at this time. An enhancement request has been opened to track this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=326548 reviewed by: matt.macivor@oracle.com tests: all unit tests pass as expected; jaxb/externalizedmetadata/xmlanyattribute/XmlAnyAttributeTestCases; jaxb/externalizedmetadata/xmlanyelement/XmlAnyElementTestCases; jaxb/externalizedmetadata/xmlattribute/XmlAttributeTestCases; jaxb/externalizedmetadata/xmlelement/XmlElementTestCases; jaxb/externalizedmetadata/xmlelement/XmlElementsTestCases; jaxb/externalizedmetadata/xmlelement/XmlValueTestCases The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |