Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Spoon 的新手,如果我设法转换类,我没有找到从头开始生成新类并将其保存到磁盘的方法。
我设法创建了一个新类,但在生成目录中没有看到它。
任何帮助将不胜感激。
此致,
阿兰
如果您只想创建一个新类,则可以执行以下操作:
final Launcher spoon = new Launcher(); CtClass<?> aClass = spoon.getFactory().Class().create("package.MyClass"); new JavaOutputProcessor(new File("output"), spoon.createPrettyPrinter()).createJavaFile(aClass);