users@jaxb.java.net

JAXBPlugin: Is it possible to move a class into another package?

From: Florian Bachmann <f.bachmann_at_micromata.de>
Date: Fri, 6 Mar 2009 11:40:55 +0100

Hi JAXB developers,
is it possible to move a class into an other package inside a JAXB-
Plugin?

For example I have something like:

public class MyPlugin extends Plugin {
@Override
public boolean run(Outline outline, Options opts, ErrorHandler
errorHandler) {
   final JCodeModel codeModel = classOutline.parent().getCodeModel();

   for (final ClassOutline classOutline : outline.getClasses()) {
     ClassOutlineImpl cc = (ClassOutlineImpl) classOutline;

     if (cc.target.isAbstract()) {
       System.out.println("class is abstract");
       System.out.println("current package is: " +
cc._package()._package().name());
       JPackage newpackage =
codeModel._package(cc._package()._package().name()+".AbstractPackage");
       System.out.println("created new package: " + newpackage.name());

       //How to move the current class to the new created package
called newpackage?
       cc._package(). //what to do here?




So my Question is: how to move the current class (in this Example all
classes, that are marked as abstract) into a new package?

regards
Flori