Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330137 - [OXM] Type information required on xml-element-decl
Summary: [OXM] Type information required on xml-element-decl
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-12 15:41 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:21 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (30.54 KB, patch)
2010-11-17 09:54 EST, David McCann CLA
no flags Details | Diff
Supporting tests (3.33 KB, patch)
2010-11-17 09:54 EST, David McCann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Barkhouse CLA 2010-11-12 15:41:02 EST
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.
Comment 1 Rick Barkhouse CLA 2010-11-12 15:41:32 EST
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"?
Comment 2 David McCann CLA 2010-11-16 15:29:19 EST
(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.
Comment 3 Rick Barkhouse CLA 2010-11-16 15:37:24 EST
Makes sense to me.
Comment 4 David McCann CLA 2010-11-17 09:54:23 EST
Created attachment 183302 [details]
Proposed fix
Comment 5 David McCann CLA 2010-11-17 09:54:40 EST
Created attachment 183303 [details]
Supporting tests
Comment 6 David McCann CLA 2010-11-17 09:55:18 EST
The uploaded patch files also address Bug 330139 - [OXM] container-type needed on xml-element-ref.
Comment 7 David McCann CLA 2010-11-17 10:57:04 EST
Reviewed by:  rick.barkhouse@oracle.com
Tests:  all unit tests pass as expected; jaxb/externalizedmetadata/xmlelementref/XmlElementRefTestCases
Rev:  8506
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:21:38 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink