| Summary: | @XmlElements and multiple @XmlElement with same type. | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
If a property is annotated with the following (note the two @XmlElement annotations associated with PhoneNumber.class): @XmlElements(value = { @XmlElement(name="address", type=Address.class), @XmlElement(name="phone-number", type=PhoneNumber.class), @XmlElement(name="fax-number", type=PhoneNumber.class), @XmlElement(name="note", type=String.class) }) public Object contactInfo; MOXy can successfully unmarshal documents containing both "phone-number" and "fax-number" elements. When it comes to the marshal operation MOXy must choose one of the elements to use. In order to allow the user to specify the element name/namespace the property could be defined as type JAXBElement. Currently this does not work. This scenario also does not appear to work in the JAXB RI. @XmlElements(value = { @XmlElement(name="address", type=Address.class), @XmlElement(name="phone-number", type=PhoneNumber.class), @XmlElement(name="fax-number", type=PhoneNumber.class), @XmlElement(name="note", type=String.class) }) public JAXBElement<Object> contactInfo;