Community
Participate
Working Groups
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;
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink