Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327930 - Validation, defaults, and content assist support for JAXB 2.2 object factories
Summary: Validation, defaults, and content assist support for JAXB 2.2 object factories
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows Vista
: P3 enhancement (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard: EclipseLink
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-10-15 13:45 EDT by Paul Fullbright CLA
Modified: 2012-03-23 10:00 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fullbright CLA 2010-10-15 13:45:47 EDT
http://wiki.eclipse.org/Dali/Indigo/JAXB_2.x/ProjectContent#ObjectFactory
http://wiki.eclipse.org/Dali/Indigo/JAXB_2.x/TypeAnnotations#.40XmlRegistry

This bug will track validation and content support for JAXB 2.2 object factories
Comment 1 Paul Fullbright CLA 2010-10-15 13:48:23 EDT
This should address support for the following annotations:
    * @XmlRegistry
    * @XmlElementDecl

as well as general support for the types of factory methods that are a part of an object factory.
Comment 2 Paul Fullbright CLA 2011-05-31 14:40:20 EDT
@XmlRegistry and @XmlElementDecl are "... intended primarily for use by schema
compiler in annotating element factory methods in the schema derived ObjectFactory class ... They are not expected to be used when mapping existing classes to schema." (sec. 8.10)

As such, there is less validation than might be expected for such a construct.  It is mostly value add for classes generated from a schema.

@XmlRegistry

- There should only be one per JAXB package
(and that's pretty much it)

@XmlElementDecl

- annotation can only be used on an element factory method (Section 5.2, “Java Package”). The annotation creates a mapping between an XML schema element declaration and a element factory method that returns a JAXBElement instance representing the element declaration.  Typically, the element factory method is generated (and annotated) from a schema into the ObjectFactory class in a Java package that represents the binding of the element declaration's target namespace.  Thus, while the annotation syntax allows @XmlElementDecl to be
used on any method, semantically its use is restricted to annotation of element factory method.  [ Not sure how this can be handled with our framework - we only would recognize the annotation only when it is used within a class already annotated with @XmlRegistry.  Instead we'd validate that the method annotated within the object factory fits the profile of a factory method. ]

- class containing the element factory method annotated with @XmlElementDecl must be annotated with @XmlRegistry. [ See above comment. ]

- element factory method must take one parameter assignable to java.lang.Object.

- two or more element factory methods annotated with @XmlElementDecl must not map to element declarations with identical {name} {target namespace} values.

- if type Foo has an element factory method and is also annotated with @XmlRootElement, then they must not map to element declarations with identical {name} and {target namespace} values.
Comment 3 Paul Fullbright CLA 2012-03-21 16:31:36 EDT
Most of this was committed for 3.1.  All of this complete by 3.2 M7.