This question has two parts:
- At compile time, you need to generate your code differently. You can write an XJC plugin for this.
- At run time, you should use a JAXB implementation that works without annotations (see Blaze's answer in this section).
Have a look at the XJC extensibility question:
XJC - extensibility?
You can write an XJC plugin that completely replaces code generation. Therefore, I can imagine an XJC plugin that generates XML mappings for MOXy instead of annotations in classes. You can also do this with JAXB RI using an optional annotation reader, but it is much more complicated than just using MOXy.
We will warn, however, that writing XJC advanced plugins is quite difficult for me.
source share