users@jaxb.java.net

Implementing Generation Gap Pattern

From: Floris Ouwendijk <floris233_at_gmail.com>
Date: Sun, 12 Jun 2011 17:14:54 +0200

Hi,

I've been looking at how to customize the JAXB binding to implement the
Generation Gap Pattern but cannot figure it out.
Essentially I would like to have xjc generate the code from a schema
file, where the generated code contains the basic implementations. I
will manually create subclasses of those generated files containing some
logic. When unmarshalling a document, I want the type to be my subclass,
and navigating the document I want the return types of all elements (or
those that I specified as using the pattern) to be my subtypes, and not
the basic implementations.
I've tried the class binding declarations and modifying the object
factory, but while instances of my classes are returned, the types are
the basic types, thus forcing me to cast.
It seems the route to go then is to create a plug-in that keeps all
references to the specified name, but generate the file with a slightly
different name.
Any suggestions on where to make the modifications? So far I've had no
luck inserting new CClassInfo objects into the model during
postProcessModel. (Or is there a way using the regular customizations?)

Kind regards,
Floris