Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Fix for bug 275374 - XML DirectCollectionMapping should support lists of lists

Fix submitted for the following bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=275374

Description:
Support should be added to MOXy to map a list of lists using a DirectCollectionMapping.
Example:

Object:

public class Root {
  public ArrayList<ArrayList<Double>> items = new ArrayList<ArrayList<Double>>();
}

XML:

<root>
    <item>1.2 3.4 5.6</item>
    <item>-7.8 -9.0 -1.2</item>
</root>
The user can now use the new XMLListConverter for this type of mapping:

XMLCompositeDirectCollectionMapping itemsMapping = new XMLCompositeDirectCollectionMapping();
itemsMapping.setAttributeName("items");
itemsMapping.setXPath("item/text()");
itemsMapping.setFieldElementClass(ArrayList.class);
itemsMapping.useCollectionClass(ArrayList.class);

XMLListConverter listConverter = new XMLListConverter();
listConverter.setObjectClass(Double.class);
itemsMapping.setValueConverter(listConverter);


Test Cases:
org.eclipse.persistence.testing.oxm.mappings.directcollection.listoflists.XMLDirectCollectionOfListsTestCases

Patch attached to bug, reviewed by bdoughan.

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

Back to the top