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.
Regards,
Joost
--
Joost Cassee
http://joost.cassee.net