Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332242 - [Validation] @XmlType validation
Summary: [Validation] @XmlType validation
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
: 345317 (view as bug list)
Depends on:
Blocks: 327929
  Show dependency tree
 
Reported: 2010-12-09 14:38 EST by Karen Butzke CLA
Modified: 2011-11-11 15:05 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2010-12-09 14:38:15 EST
1.An XmlType class must have a no-arg constructor or a factoryMethod defined. no-arg constructor can be public, protected, or private

2. @XmlType factoryMethod must be a static zero-arg method found in the factoryClass. If the factoryClass is not specified, it is assumed to be the XmlType's class.

As far as I can tell these validation messages are the same for MOXy as for generic JAXB.
Comment 1 Karen Butzke CLA 2010-12-09 15:10:41 EST
> no-arg constructor can be public, protected, or private

I might be wrong about this, the XmlType javadocs say it needs to be public, but it seems like public, protected or private are supported.
Comment 2 Paul Fullbright CLA 2011-01-18 16:13:01 EST
I have added the following schema-based validation :

3. if name is absent (""), namespace cannot be different from package namespace
4. if name is not absent (""), type must be from schema associated with this package
Comment 3 Paul Fullbright CLA 2011-05-27 13:56:25 EDT
from bug 345317:

Validation and content assist are still needed for XmlType (factoryClass,
factoryMethod, and propOrder)
Comment 4 Paul Fullbright CLA 2011-05-27 13:57:07 EDT
*** Bug 345317 has been marked as a duplicate of this bug. ***
Comment 5 Paul Fullbright CLA 2011-06-02 11:17:05 EDT
When used on an enum, factoryMethod(), factoryClass(), and propOrder() must be ignored (should be warning at least)
Comment 6 Paul Fullbright CLA 2011-10-19 17:26:02 EDT
Added propOrder validation and content assist for 3.1 M3.
Comment 7 Paul Fullbright CLA 2011-10-26 11:43:34 EDT
(In reply to comment #5)
> When used on an enum, factoryMethod(), factoryClass(), and propOrder() must be
> ignored (should be warning at least)

This has been fixed in 3.1 M3.
Comment 8 Paul Fullbright CLA 2011-11-11 15:05:39 EST
Added validation for:
- public or protected (not private) zero-arg constructor or the default constructor
- factory method must be specified when factory class is specified

for 3.1 RC1.


Tracking further validation for factoryClass/factoryMethod in bug 363617 so that this bug can be closed for 3.1.