Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322423 - Allow the key/value XPaths for Map properties to be customized
Summary: Allow the key/value XPaths for Map properties to be customized
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 15:19 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:35 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Blaise Doughan CLA 2010-08-11 15:19:43 EDT
Currently for a Map property, the XML representation is always the same:

For the property:

    public Map<String, PhoneNumber> phoneNumbers = new HashMap<String, PhoneNumber>(); 

You get the XML:

    <phoneNumbers>
        <entry>
            <key>work</key>
            <value>613-555-1111</value>
        </entry>
    </phoneNumbers>

Metadata should be available to customize this, possibly:

    @XmlMap(wrapper="my-entry", key="@my-key", value="my-value")
    public Map<String, PhoneNumber> phoneNumbers = new HashMap<String, PhoneNumber>(); 

Then you could get the XML:

    <phoneNumbers>
        <my-entry my-key="work">
            <my-value>613-555-1111</value>
        </my-entry>
    </phoneNumbers>
Comment 1 Blaise Doughan CLA 2010-10-14 10:33:01 EDT
Note:  The representation should match the support in oxm.xml for maps.
Comment 2 Blaise Doughan CLA 2010-10-14 10:41:53 EDT
This annotation should also allow for the key/value types to be specified.  The OXM should also allow the key/value XPaths to be set.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:35:33 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink