users@jaxb.java.net

Re: Delegation and binding

From: Gary Gregory <ggregory_at_seagullsw.com>
Date: Wed, 12 Feb 2003 15:11:14 -0500

From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
>I personally don't think it's a good idea to use JAXB to replace your
domain object model. You should have nicely cleanly designed domain
object model at the heart of your application and you should use JAXB
just as a type-safe vocabulary-friendly parser.

Can you be more specific and elaborate on this point please?

(1) In the "old" days:

XML <- Xerces -> DOM tree <- pile of nasty custom code -> App model

(2) JAXB 1.0beta "easy" route:

XML <- JAXB -> App model with wrappers to JAXB generated code which can use
delegation.

(3) KK suggests:

XML <- JAXB -> pile of custom code -> App model.

?

Yes, I am gaining XML Schema support which I am very thankful for, but I am
then trading one pile of custom mapping code for another? Of course I see
that this extra decoupling allows for both models to evolve independently at
the cost of maintaining the mapping code.

What do you and your colleagues consider an appropriate approach?

Thank you for considering this issue,
Gary


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Wednesday, February 12, 2003 11:52 AM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Delegation and binding


> BTW PRIMARY_INTERFACE_CLASS is declared as final. If it was mutable,
> we might be able to customize unmarshaller to subclass at runtime. Can
that restriction be removed?

Unfortunately PRIMARY_INTERFACE_CLASS is not only final but also static.

As you probably know, the issue of adding behavior to the generated code
is really non-trivial, even if you are willing to become dependent to RI.

I personally don't think it's a good idea to use JAXB to replace your
domain object model. You should have nicely cleanly designed domain
object model at the heart of your application and you should use JAXB
just as a type-safe vocabulary-friendly parser.

That said, I think the easiest short-term RI-specific solution is to
make it possible to subclass RI-generated class. The long-term solution
should be something implementation agnostic, but not sure how it looks
like.


regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com