Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322423

Summary: Allow the key/value XPaths for Map properties to be customized
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: paul.fullbright
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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