JAXB 2.0 | Tools | JAXB 1.0.x | JAXB RI Extensions | JAXB Community |
This document describes how to write an XJC plugin to extend the code generation of XJC.
An XJC plugin participates in the code generation from a schema. It can define its own customizations that users can use to control it, it can access the code that the JAXB RI generates, it can generate additional classes/methods/fields/annotations/comments, and it can also replace some of the pluggability points in the compilation process, such as XML name -> Java name conversion.
As a show case of what a plugin can do, take a look at plugins hosted at JAXB2-commons.
To write a plugin, do the following simple steps.
Users can then use your plugins by declaring an XJC ant task with your jar files.
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask"> <classpath> <fileset dir="jaxb-ri/lib" includes="*.jar" /> <fileset dir="your-plugin" includes="*.jar" /> </classpath> </taskdef>
See this page for more detailed, up-to-date information.
Although we will do our best to maintain the compatibility of the interfaces, it is still subject to change at this point.