users@jaxb.java.net

Re: Java inheritance

From: David Blevins <david.blevins_at_visi.com>
Date: Tue, 11 Jul 2006 16:17:21 -0700

On Jul 11, 2006, at 3:42 PM, Kohsuke Kawaguchi wrote:

> David Blevins wrote:
>> These two posts seem to detail quite nicely what I'm facing.
>> https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=4111
>> https://jaxb.dev.java.net/servlets/ReadMsg?listName=users&msgNo=4252
>> In short, I've generated a JAXB2 annotated Java tree from the Java
>> EE 5 ejb-jar xsd and would now like to introduce a superclass
>> (EnterpriseBean) for EntityBeanType, MessageDrivenBeanType and
>> SessionBeanType as 80% of their properties are the same.
>> I'm finding this to be an impossible task as declaring the
>> propOrder in the subclass results in the
>> "..._at_XmlType.propOrder... no such property exists" exception and
>> declaring a @XmlType.propOrder in the superclass gives me the
>> wrong order in xml.
>> What will it take to support this feature? I understand there may
>> be issues, but I'm almost certain i'd prefer those issues over
>> this one.
>
> One of the things that we are discussing toward JAXB 2.1 is to have
> the notion of "not mapping super class" then you can do something
> like:
>
> @XmlTransient abstract class EnterpriseBean {
> get/setA();
> get/setC();
> }
>
> @XmlType(propOrder={"a","b","c"})
> class EntityBeanType extends EnterpriseBean {
> get/setB();
> }
>
> the same with MessageDrivenBeanType and SessionBeanType.
>
> Would this feature make you happy?

Extremely! That's right on the money.

How far off into the future is something like that? You referring to
v2.1 of the RI or the JAXB spec itself (or perhaps both)?

-David


> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com