On Wed, 2009-07-29 at 14:56 -0700, alesque wrote:
> I created a plugin and I tried to modify the in memory class model through
> the codemodel package. I didn't find any related methods to remove
> annotations.
There are none, the codemodel classes are used in building the code
model (rather than managing the code model).
>
> Can I remove annotations through the codemodel api?
Theoretically, yes. Use the reflection, set the private fields
accessible (see the java.lang.reflect.AccesibleObject) and manipulate
the data members of the codemodel classes directly (I reckon you'll be
interested in *starting* with the JDefinedClass#annotation data member).
Never done it myself (personal opinio: that's a hack, not a
construction), so if you want to do it this way, a sincere wish of "good
luck" in studying the source code in the codemodel.
But since it's about writing a plugin *and* the study of the JAXB source
code, I'd recommend you to study the way xjc works, then
using/overriding/replacing the classes in
com.sun.tools.xjc.generator.bean.field package in your plugin (which
should build the classes in the way you need - as opposed to hack away
chunks of already "generated" code).
>
> Regards,
> Alexandre
Regards,
no0ne