use of javax.tools.FileObject in project mapstruct by mapstruct.
the class MapperServiceProcessor method createSourceFile.
private void createSourceFile(ServicesEntry model, ModelWriter modelWriter, Filer filer) {
String fileName = model.getPackageName() + "." + model.getName();
FileObject sourceFile;
try {
sourceFile = filer.createResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/services/" + fileName);
} catch (IOException e) {
throw new RuntimeException(e);
}
modelWriter.writeModel(sourceFile, model);
}
use of javax.tools.FileObject in project fabric8 by jboss-fuse.
the class AbstractKubernetesAnnotationProcessor method generateYaml.
void generateYaml(String fileName, KubernetesResource resource) {
try {
FileObject fileObject = getFileObject(fileName);
KubernetesHelper.saveYaml(resource, fileObject);
} catch (IOException e) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Error generating json " + fileName);
}
}
use of javax.tools.FileObject in project copybara by google.
the class AnnotationProcessor method writeClassList.
private void writeClassList(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) throws IOException {
List<String> classNames = Streams.concat(elementsByAnnotation.get(Library.class).stream(), elementsByAnnotation.get(StarlarkBuiltin.class).stream()).map(AnnotationProcessor::className).collect(toImmutableList());
FileObject res = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", "starlark_class_list.txt");
try (Writer writer = res.openWriter()) {
writer.append(Joiner.on("\n").join(classNames)).append("\n");
}
}
Aggregations