dev@jaxb.java.net

Migrating a large JAXB v1.x project to JAXB v2.x & interfaces

From: Chisarick, Dan <Dan.Chisarick_at_fnf.com>
Date: Wed, 15 Nov 2006 22:13:36 -0600

Hi. I've read through the FAQ, the specification, and a bunch of the
mailing list archives. I realize that the JAXB v1.x generated
interfaces were done away with, and I understand the motivation. Still,
there's this small matter of a few thousand references to those
interfaces in our existing code base. It's just not practical to
migrate them all right now.

At least as a transitional step, I'd like to generate those interfaces
just so the code compiles and work can continue identifying the
feasibility of moving to JAXB2. A plug-in seems to be the approach to
take. Currently I have a development project open where I have a
skeletal plugin that just prints out stuff like the target directory for
class generation, the class type name and it's package name. Ok, good
so far. Here's what I (think I) still need to do:

1) Set an additional interface for each generated class. Assuming "co"
is a ClassOutline instance, this seems to work:

co.implClass._implements(MyNewInterface.class);

Unfortunately that only works for interface classes that already exist.
Since I'm generating them dynamically, that doesn't work too well. I
see there's an overloaded method that takes a JClass, but the means for
creating one is sending me in circles.

Question 1: How can I specify the name of an interface for a JAXB
generated class when that interface does not exist? I'd like to be able
to specify the interface simply as a String if possible.

2) In order to generate the interface, I need to know the public methods
of each generated class. Any pointers on how I can retrieve that
information starting w/a ClassOutline instance?

I am a little new to the internals of JAXB2 so if what I'm trying to do
(discouraged though it may be) has already been addressed somewhere, I
missed it. Thanks.

Dan