0

I'm newbie with Spoon and, if I managed to transform class I did not find the way to generate a new class from scratch and save it to disk.

I managed to create a new class but I did not see it in the generation directory.

Any help would be greatly appreciated.

Best regards,

Alain

AMuse
  • 1
  • 1

1 Answers1

1

If you would only create a new class you can do something like this:

final Launcher spoon = new Launcher();
CtClass<?> aClass = spoon.getFactory().Class().create("package.MyClass");
new JavaOutputProcessor(new File("output"), spoon.createPrettyPrinter()).createJavaFile(aClass);
Thomas Durieux
  • 466
  • 2
  • 5