Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345969 - Enhancement: New Mapping @ValueNode
Summary: Enhancement: New Mapping @ValueNode
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 11:33 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:32 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 2011-05-16 11:33:20 EDT
A common request from users is how to set a value based on the existence of an element/attribute (see link below).  This enhancement request is for a solution to this problem.

http://stackoverflow.com/questions/5969265/how-do-i-assign-a-boolean-value-based-on-the-existence-of-an-element-in-jaxb

The initial proposal is to introduce 2 new annotations @XmlValueNode/@XmlValueNodes that map a value to the existence of an XML node.

Example #1

@XmlValueNode(xpath="OPEN", value="true"
public boolean isOpen() {
    return open
}

Example #2

@XmlValueNodes({
    @XmlValueNode(xpath="green", value="GREEN"),
    @XmlValueNode(xpath="yellow", value="YELLOW"),
    @XmlValueNode(xpath="red", value="RED")
})
public TrafficLightEnum getLightColour() {
    return lightColour;
}
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:32:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink