users@jaxb.java.net

Re: XJC plugin that rewrites class names

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 16 Feb 2007 12:12:31 -0800

Cool. I linked it from https://jaxb2-commons.dev.java.net/

Joost Cassee wrote:
> Dear all,
>
>
> Tired of having to specifiy package name on classes if my XML type have
> the same name as my Java classes, I made an XJC plugin that rewrites
> class names. It is used by adding '-Xclassname
> -Xclassname-substitution=/<search>/<replace>/' to the XJC command line.
> (The plugin JAR must be on the classpath, of course.)
>
> If (like me) you use Maven, add
>
> <args>
> <arg>-Xclassname</arg>
> <arg>-Xclassname-substitution=/<search>/<replace>/</arg>
> </args>
>
> to the JAXB plugin configuration.
>
> I use '-Xclassname-substitution="/$/XML/"' to make all generated class
> names end in 'XML'. For example, the XML element 'order' generates class
> name 'OrderXML'.
>
> The plugin (and source) can be found at:
> http://www.cassee.org/repository/org/cassee/xjc-plugins/classname/0.1/
> Maven generated site at:
> http://www.cassee.org/xjc-plugins/classname/
> (The issue tracking system is not yet online.)
>
> I more than welcome comments, especially on what features to add and how
> to do tests.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com