Examples of openWriter()


Examples of javax.tools.JavaFileObject.openWriter()

 
  private void generateSourceFile(FactoryModel model) {
    try {
      String factoryName = model.declaration.getQualifiedName() + "Impl";
      JavaFileObject src = filer.createSourceFile(factoryName, model.declaration);
      PrintWriter writer = new PrintWriter(src.openWriter());
      writer.println(formatter.generate(model));
      writer.flush();
      writer.close();
    } catch (IOException e) {
      messager.printMessage(Kind.ERROR, e.getMessage(), model.declaration);
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

     */
    private PrintWriter createSourceFile(String originalClass, String metaClass, TypeElement e)
        throws IOException {
        JavaFileObject javaFile = processingEnv.getFiler().createSourceFile(metaClass, e);
        logger.info(_loc.get("mmg-process", javaFile.toUri().normalize()));
        return new PrintWriter(javaFile.openWriter());
    }
   
    /**
     * Get the value for the given keys, whoever matches first, in the current available options.
     */
 
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

     */
    private PrintWriter createSourceFile(String originalClass, String metaClass, TypeElement e)
        throws IOException {
        JavaFileObject javaFile = processingEnv.getFiler().createSourceFile(metaClass, e);
        logger.info(_loc.get("mmg-process", javaFile.toUri().normalize()));
        return new PrintWriter(javaFile.openWriter());
    }
   
    /**
     * Get the value for the given keys, whoever matches first, in the current available options.
     */
 
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

     */
    private PrintWriter createSourceFile(String originalClass, String metaClass, TypeElement e)
        throws IOException {
        JavaFileObject javaFile = processingEnv.getFiler().createSourceFile(metaClass, e);
        logger.info(_loc.get("mmg-process", javaFile.toUri().normalize()));
        return new PrintWriter(javaFile.openWriter());
    }
   
    /**
     * Get the value for the given keys, whoever matches first, in the current available options.
     */
 
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

   public void write(final String data) {
     Writer writer = null;
     try {
       clearOldVersions(packageName, className);
       JavaFileObject file = processingEnv.getFiler().createSourceFile(packageName + "." + className);
       writer = file.openWriter();
       writer.append(data).flush();
     } catch (IOException e) {
       throw new IllegalStateException(e);
     } finally {
       if (writer != null) {
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

    for (TableObject tableObject : tableObjectCache.values()) {
      logger.d("Writing for " + tableObject.getTableName());
      Element element = tableObject.getOriginatingElement();
      try {
        JavaFileObject jfo = filer.createSourceFile(tableObject.getFqcn(), element);
        Writer writer = jfo.openWriter();
        tableObject.brewJava(writer);
        writer.flush();
        writer.close();
      } catch (IOException e) {
        logger.e(String.format(
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

        JavaFileObject sourceFile = filer.createSourceFile(generatedClassName);

        StephenerializationPreprocessorFieldGenerator generator = new StephenerializationPreprocessorFieldGenerator();
        Set<StephenerializationPreprocessorField> fields = generator.generateFields(element);

        PreprocessingWriter w = new PreprocessingWriter(sourceFile.openWriter());

        writePackageImportsAndClass(w, element, simpleGeneratedClassName);

        w.indent();
        writeWriteMethod(w, className, fields, stephenerializable);
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

                                               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)
                    log.printVerbose("wrote.file", outFile);
            } finally {
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

        String className = fm.inferBinaryName(StandardLocation.SOURCE_PATH, tree.getSourceFile());
        JavaFileObject fo = fm.getJavaFileForOutput(StandardLocation.SOURCE_OUTPUT,
                className, JavaFileObject.Kind.SOURCE, null);
        // System.err.println("Writing " + className + " to " + fo.getName());
        Writer out = fo.openWriter();
        try {
            new Pretty(out, true).printExpr((JCTree) tree3);
        } finally {
            out.close();
        }
View Full Code Here

Examples of javax.tools.JavaFileObject.openWriter()

      return null;
    }

    try {
      JavaFileObject obj = state.filer.createSourceFile(packageName + "." + simpleName, x);
      Writer w = obj.openWriter();
      w.write(sb.toString());
      w.close();
    } catch (Exception e) {
      StringWriter sw = new StringWriter();
      e.printStackTrace(new PrintWriter(sw));
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.