Community
Participate
Working Groups
@XmlType public class Employee { private Collection<String> foos; private int bar; public Collection<String> getFoos() { return foos; } public int getBar() { return bar; } } EclipseLink schema generation generates elements for both foos and bar. The metro implementation does not since neither of them have a corresponding setter. If getFoos() returns a List instead of a collection, then the foos element should be generated.
From section B.5 "Getters/Setters" of the JAXB 2.2 spec: "Unmarshalling : A property must have a setter method if • @XmlAccessorType.PUBLIC_MEMBER or @XmlAccessorType.PROPERTY applies to the property. • or if the property’s getter/setter method is annotated with a mapping annotation." MOXy Interpretation: That means that if a setter is present the property should be unmarshalled "Marshalling: A property must have a getter method if • @XmlAccessType.PUBLIC_MEMBER or @XmlAccessType.PROPERTY applies to the class • or if the property’s getter/setter method is annotated with a mapping annotation." MOXy Interpretation: That means that if a getter is present the property should be marshalled Decision: Since the presence of only a getter or setter affects marshalling/unmarshalling then those properties should be reflected in the XML schema.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink