Package javax.tools

Examples of javax.tools.JavaFileObject.openOutputStream()


    private void writeBindingFile() throws Exception {
        JavaFileObject sourceFile = filer.createSourceFile(BINDING_FILENAME);
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("extensions", discoveredBindings);

        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(BINDING_TEMPLATE, model, output);

        output.flush();
        output.close();
    }
View Full Code Here


        Map<String, Object> model = new HashMap<String, Object>();
        model.put("extensions", discoveredExtensions);

        JavaFileObject sourceFile = filer.createSourceFile(EXTENSION_FILENAME);
        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(EXTENSION_TEMPLATE, model, output);
        output.flush();
        output.close();

    }
View Full Code Here

        }
        JavaFileObject javaFile = fileManager.getJavaFileForOutput(StandardLocation.SOURCE_OUTPUT,
            metaClass, JavaFileObject.Kind.SOURCE,
            null); // do not use sibling hint because of indeterminable behavior across JDK
        logger.info(_loc.get("mmg-process", javaFile.toUri()));
        OutputStream out = javaFile.openOutputStream();
        PrintWriter writer = new PrintWriter(out);
        return writer;
    }
   
    /**
 
View Full Code Here

      logger.log("Generating source file for: %s", name.getQualified());
      logger.log("   Found: %d inner beans", node.getNestedBeans().size());

      JavaFileObject source = env.getFiler().createSourceFile(name.getQualified(), node.getElement());
     
      writer = new SourceWriter(source.openOutputStream());

      writer.header(node.getName().getNamespace());
      writer.line();

      Optional<QualifiedName> scn = Optional.of(node.getSuperclass().isSet()
View Full Code Here

        JavaFileObject outFile
            = fileManager.getJavaFileForOutput(CLASS_OUTPUT,
                                               c.flatname.toString(),
                                               JavaFileObject.Kind.CLASS,
                                               c.sourcefile);
        OutputStream out = outFile.openOutputStream();
        try {
            writeClassFile(out, c);
            if (verbose)
                log.errWriter.println(log.getLocalizedString("verbose.wrote.file", outFile));
            out.close();
View Full Code Here

    public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
        if (!fileName.endsWith(JAVA_SOURCE_SUFFIX))
            throw new IllegalStateException("Unexpected file name passed to code writer: " + fileName);
        String className = fileName.substring(0, fileName.length() - JAVA_SOURCE_SUFFIX.length());
        JavaFileObject fileObject = filer.createSourceFile(pkg.name() + "." + className);
        OutputStream stream = fileObject.openOutputStream();
        closeables.add(stream);
        return stream;
    }

    @Override
View Full Code Here

    private void writeAccessControlFile() throws Exception {
        Map<String, Object> model = new HashMap<>();
        model.put("metaData", accessControlDeclararions);

        JavaFileObject sourceFile = filer.createSourceFile(ACCESS_FILENAME);
        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(ACCESS_TEMPLATE, model, output);
        output.flush();
        output.close();
    }
View Full Code Here

        Map<String, Object> model = new HashMap<>();
        model.put("extensions", discoveredExtensions);

        JavaFileObject sourceFile = filer.createSourceFile(EXTENSION_FILENAME);
        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(EXTENSION_TEMPLATE, model, output);
        output.flush();
        output.close();

    }
View Full Code Here

    private void writeBindingFile() throws Exception {
        JavaFileObject sourceFile = filer.createSourceFile(BINDING_FILENAME);
        Map<String, Object> model = new HashMap<>();
        model.put("extensions", discoveredBindings);

        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(BINDING_TEMPLATE, model, output);

        output.flush();
        output.close();
    }
View Full Code Here

        Map<String, Object> model = new HashMap<>();
        model.put("extensions", discoveredBeanFactories);
        model.put("categoryClasses", categoryClasses);

        JavaFileObject sourceFile = filer.createSourceFile(BEAN_FACTORY_FILENAME);
        OutputStream output = sourceFile.openOutputStream();
        new TemplateProcessor().process(BEAN_FACTORY_TEMPLATE, model, output);
        output.flush();
        output.close();
    }
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.