Tag: 速度

在“注释处理器”中为生成的类指定路径

我正在创建一个Android应用程序。 我使用AbstractProcessor从Annotated类和Velocity模板生成我自己的类。 这是生成源文件的方法。 private void createSourceFile(String className, String packageName, VelocityContext context, Template template) throws IOException { final JavaFileObject javaFileObject = processingEnv.getFiler().createSourceFile(packageName + "." + className); processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "creating file: " + javaFileObject.toUri()); final Writer writer = javaFileObject.openWriter(); if (DEBUGGING) { processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "applying velocity template: " + template.getName()); } template.merge(context, writer); writer.close(); } 我的问题是 我可以为生成的类指定一个目录吗? 现在他们在build / […]