Community
Participate
Working Groups
To support ObjectFactory-related features (e.g. substitution groups) in Dynamic JAXB, type information will have to be added to xml-element-decl, so that a full method signature for each create() method can be generated in memory. Currently XmlElementDecls are defined in OXM as follows: <xml-element-decl namespace="myNamespace" name="personne" java-method="createPersonne" substitutionHeadNamespace="myNamespace" substitutionHeadName="person"/> A typical ObjectFactory method for this declaration would look like: @XmlElementDecl(namespace = "myNamespace", name = "personne", substitutionHeadNamespace = "myNamespace", substitutionHeadName = "person") public JAXBElement<Person> createPersonne(Person value) { return new JAXBElement<Person>(_Personne_QNAME, Person.class, null, value); } However for Dynamic JAXB, a representation of ObjectFactory is created (implements JavaClass) in memory, and in order to have the proper return type (JAXBElement<Person>), we would need to have that "Person" information available in the xml-element-decl element.
Not sure what we should call it though, "type" will really always be JAXBElement, so maybe it would make more sense to call it "element-type"?
(In reply to comment #1) > Not sure what we should call it though, "type" will really always be > JAXBElement, so maybe it would make more sense to call it "element-type"? Since for List<Employee> type=Employee and container-type=List, I think we should go with 'type', i.e. for JAXBElement<Employee> type="Employee" and JAXBElement would be the same as container-type in the List<Employee> case.
Makes sense to me.
Created attachment 183302 [details] Proposed fix
Created attachment 183303 [details] Supporting tests
The uploaded patch files also address Bug 330139 - [OXM] container-type needed on xml-element-ref.
Reviewed by: rick.barkhouse@oracle.com Tests: all unit tests pass as expected; jaxb/externalizedmetadata/xmlelementref/XmlElementRefTestCases Rev: 8506
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink