users@jaxb.java.net

Re: xjc plugin to generate a radically different code from a schema.

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 27 Feb 2008 09:58:22 +0100

Hi.

> According to the plugin page https://jaxb.dev.java.net/plugin.html :
>
> "A plugin can also choose to take over the XJC's code generation process
> completely. Only one plugin can do this at any given time, but this allows
> a
> plugin to generate a radically different code from a schema."
>
> However there is absolutely no docs (or i could not find) on how to do this.
> Can
> anyone please share how i can accomplish this ? I already have a plugin
> working. But i cant stop xjc from generating files. My plugin already takes
> care of the generation part.
>
> p.s.
> I posted this also on the ml as well under :
> https://jaxb.dev.java.net/servlets/ReadMsg?list=dev&msgNo=272

I'd simply suggest that you check out the source code of JAXB2 RI and
take a look what's going on. Things that you refer to are not intended
for a wide audience, it's just a dozen of people who'd be interested
in this, that's why I guess it's not documented that well.

Answering your question, in the plugin you can implement the
onActivated(Options options) method which is called before any
generation takes place. In the given Options object there's quite a
few setting you can change. What you refer to is probably
FieldRendererFactory which is responsible for creating code from the
JAXB2 internal model. Write your own factory and set it in onActivated
- and you'll generate different code for the same schema.

Bye.
/lexi