Package javax.tools

Examples of javax.tools.JavaFileObject.openWriter()


            for (Type type : types) {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    //mustache.execute(writer, type).flush();
                    template.process(type, writer);
                }
            }
        } catch (IOException | TemplateException e) {
View Full Code Here


            String qualifiedCanonicalName = persistenceUnit.getQualifiedCanonicalName(qualifiedName);
            String canonicalName = getName(qualifiedCanonicalName);
            String canonicalpackage = getPackage(qualifiedCanonicalName);
           
            JavaFileObject file = processingEnv.getFiler().createSourceFile(qualifiedCanonicalName, element);
            writer = file.openWriter();
           
            // Print the package if we have one.
            if (! canonicalpackage.equals("")) {
                writer.append("package " + canonicalpackage + ";\n\n");
            }
View Full Code Here

        }

        Writer writer = null;

        try {
          writer = jfo.openWriter();
          generateClass(className, entry.getValue(), writer);
        } finally {
          if (writer != null) {
            writer.close();
          }
View Full Code Here

            String qualifiedCanonicalName = persistenceUnit.getQualifiedCanonicalName(qualifiedName);
            String canonicalName = getName(qualifiedCanonicalName);
            String canonicalpackage = getPackage(qualifiedCanonicalName);
           
            JavaFileObject file = processingEnv.getFiler().createSourceFile(qualifiedCanonicalName, element);
            writer = file.openWriter();
           
            // Print the package if we have one.
            if (! canonicalpackage.equals("")) {
                writer.append("package " + canonicalpackage + ";\n\n");
            }
View Full Code Here

    completeAbstractMountPoints(context);

    String infoClassName = context.getApplicationClassTypeElement().getSimpleName() + "MountInfo";
    jfo = processingEnv.getFiler().createSourceFile(context.getApplicationClassTypeElement().getQualifiedName() + "MountInfo");

    bw = new BufferedWriter(jfo.openWriter());

    Map<TypeElement, String> mountPoints = context.getMountPoints();

    bw.append("package ");
    bw.append(context.getApplicationPackage().getQualifiedName());
View Full Code Here

                 null);
        if (inputFiles.contains(outFile)) {
            log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
            return null;
        } else {
            BufferedWriter out = new BufferedWriter(outFile.openWriter());
            try {
                new Pretty(out, true).printUnit(env.toplevel, cdef);
                if (verbose)
                    printVerbose("wrote.file", outFile);
            } finally {
View Full Code Here

            try {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    mustache.execute(writer, type).flush();
                }
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
View Full Code Here

    }

    private void generateEventizers(TypeElement iface) throws IOException {
        PackageElement pkg = getPackage(iface);
        JavaFileObject file = processingEnv.getFiler().createSourceFile(pkg.getQualifiedName() + ".Foo");
        Writer w = file.openWriter();
        w.write("package " + pkg.getQualifiedName() + "; class Foo {}");
        w.close();
    }

    private static PackageElement getPackage(Element e) {
View Full Code Here

            String qualifiedCanonicalName = persistenceUnit.getQualifiedCanonicalName(qualifiedName);
            String canonicalName = getName(qualifiedCanonicalName);
            String canonicalpackage = getPackage(qualifiedCanonicalName);
           
            JavaFileObject file = processingEnv.getFiler().createSourceFile(qualifiedCanonicalName, element);
            writer = file.openWriter();
           
            // Print the package if we have one.
            if (! canonicalpackage.equals("")) {
                writer.append("package " + canonicalpackage + ";\n\n");
            }
View Full Code Here

    Element origin = env.get(controller.getHandle());
    Collection<HandlerMetaModel> methods = controller.getHandlers();
    Writer writer = null;
    try {
      JavaFileObject file = env.createSourceFile(fqn + "_", origin);
      writer = file.openWriter();

      //
      writer.append("package ").append(fqn.getParent()).append(";\n");

      // Imports
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.