users@jaxb.java.net

Re: Anyone using JAXB2 Basics inheritance?

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 23 Mar 2011 19:35:13 +0100

Hi,

> Right, manually doing it is probably the easiest route for me.
> That works, but I am trying to automate the creation of the derived classes
> as much as possible.  My XSD has gone through a variety of changes as I work
> through the initial stages of this project.  I feel like this "XSD churn" is
> probably going to happen to some degree in future projects where we reuse
> some of the underlying code.
> Also, some of the changes I needed didn't become apparent until I began
> implementing the business logic specific to this project.  After each
> change, I leverage XJC to create the derived classes.  With this generated
> code I feel the difference between 0 and any hand-crafting of the code is
> larger than with other generated code where you're already expected to
> modify it to some degree.

Having interfaces defined manually has also some theoretic appeal.
Namely, with interfaces you're basically putting a border between
generated code and code which is manually written. This border must be
stable enough. That's why writing these interfaces manually is
actually the right thing to do.

The problem is, however, that these interfaces may be too many to
write and implement. Some schemas produce hundreds of classes.

> For now, I'll probably just wind up doing this by hand, as you suggest.  But
> I'd be willing to help with the "extract" plugin for interfaces.

You can start by checking out and compiling the source code of JAXB2
Basics. See if you'll get along with the XJC plugin development. It's
a bit tricky. I could provide further input then.

Bye,
/lexi