users@jaxb.java.net

Re: jaxb1 problem with complex-types vs elements

From: Ed Mooney <Ed.Mooney_at_Sun.COM>
Date: Mon, 26 Jun 2006 21:54:06 -0400

Hi Christoph,

Christoph Sturm wrote:
> Hello again!
>
> Here is the testcase i sent along:
>
>
> MyEL myEL = o.createMyEL();
> myEL.setWhatever("whatever");
> AnotherElement anotherElement = o.createAnotherElement();
>
> If MyEL didnt extend MyCT, the next line would generate a compile time
> error:
> anotherElement.setCtHolder(myEL);
>
> I just think it is error prone that in the code that xjc generates
> MyEL extends MyCT. I dont see what benefits it brings, it just makes
> it easy to make coding mistakes.
> MyEL and MyCT dont have a "is a" relationship, you cant say MyEL is a
> MyCT. making MyEL extend MyCT just isnt correct from an OO
> perspective.
>
> this setter: anotherElement.setCtHolder();
> must always be invoked with an object of type MyCT. Making MyEL extend
> MyCT gives the impression that MyEL can be used in any place that MyCT
> can be used.
>
> If you still dont kno where I'm getting to, please finish this sentence:
> "In the code that xjc generated for your schema, MyEL extends MyCT
> because _____"

... that's how it's specified in Section 5.3. Please see the spec at:

     http://java.sun.com/xml/downloads/jaxb.html

>
> thanks, and sorry if that was too verbose, I just want to make sure
> you know what my issue is.

Please file an issue if you'd like it to be specified otherwise.

>
> regards
> chris
>
>
[ ... ]

Regards,
-- 
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho