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

Bug 345969

Summary: Enhancement: New Mapping @ValueNode
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: martin.grebac
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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