I've written an XJC plugin for altering generated classes including: property
pluralization (similar to but not requiring simple-and-better-binding-mode),
renaming classes/properties, and adding interfaces and/or arbitrary code to
classes, all based on exact or regex name matching.
I'd like to gauge interest, obtain feedback, and find out about contributing
it to the jaxb2-commons project.
A sample external binding configuration is below:
<bindings
xmlns="
http://java.sun.com/xml/ns/jaxb"
xmlns:xs="
http://www.w3.org/2001/XMLSchema" version="2.1"
extensionBindingPrefixes="b"
xmlns:b="
http://frohoff.org/ns/xjc/beans">
<bindings schemaLocation="test.xsd" node="/xs:schema">
<globalBindings choiceContentProperty="true">
</globalBindings>
<schemaBindings>
<package name="org.frohoff.jaxb.test"></package>
</schemaBindings>
<b:class name-match="(\w+)RefType">
<b:implement class="org.frohoff.jaxb.test.Ref" />
</b:class>
<b:class name-match="(\w+)DefType">
<b:implement class="org.frohoff.jaxb.test.Def" />
</b:class>
<b:class>
<b:property name-match="(\w+)Or\1Ref">
<b:rename replacement="$1" />
<b:pluralize/>
</b:property>
<b:code>
public void test() {
System.out.println("this is a test");
}
</b:code>
</b:class>
</bindings>
</bindings>
-Chris Frohoff
--
View this message in context: http://www.nabble.com/XJC-plugin-tp19354645p19354645.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.