Package javax.tools

Examples of javax.tools.JavaFileObject.toUri()


                currentFolder.mkdirs();
              }
            } else {
              // create the subfolfers is necessary
              // need a way to retrieve the folders to create
              String path = javaFileForOutput.toUri().getPath();
              int index = path.lastIndexOf('/');
              if (index != -1) {
                File file = new File(path.substring(0, index));
                file.mkdirs();
              }
View Full Code Here


    generator.generateSource(builderModel);
    writer.close();

    generatedTypeNames.add(qualifiedName);
    note(String.format("PojoBuilder: Generated class %s", qualifiedName), null);
    LOG.fine(String.format("Generated %s", jobj.toUri()));
  }

  private Element[] asArray(Collection<Element> elements) {
    Element[] result = new Element[elements.size()];
    elements.toArray(result);
View Full Code Here

    generator.generateSource(manualBuilderModel);
    writer.close();

    generatedTypeNames.add(qualifiedName);
    note(String.format("PojoBuilder: Generated class %s", qualifiedName), null);
    LOG.fine(String.format("Generated %s", jobj.toUri()));
  }

  private boolean typeExists(String qualifiedName) {
    return processingEnv.getElementUtils().getTypeElement(qualifiedName) != null;
  }
View Full Code Here

        File path = test_src.getCanonicalFile();
        File src = new File(new File(path, "."), "T6440333.java");
        JavaFileObject fo = fm.getJavaFileObjects(src).iterator().next();
        URI expect = src.getCanonicalFile().toURI();
        System.err.println("Expect " + expect);
        System.err.println("Found  " + fo.toUri());
        if (!expect.equals(fo.toUri())) {
            throw new AssertionError();
        }
    }
    public static void main(String... args) throws IOException {
View Full Code Here

        File src = new File(new File(path, "."), "T6440333.java");
        JavaFileObject fo = fm.getJavaFileObjects(src).iterator().next();
        URI expect = src.getCanonicalFile().toURI();
        System.err.println("Expect " + expect);
        System.err.println("Found  " + fo.toUri());
        if (!expect.equals(fo.toUri())) {
            throw new AssertionError();
        }
    }
    public static void main(String... args) throws IOException {
        new T6440333().test(args);
View Full Code Here

            String message = diagnostic.getMessage(null);
            JavaFileObject fObj = diagnostic.getSource();
            String file;

            if (fObj != null) {
                file = fObj.toUri().toString();
            } else {
                file = "";
            }

            logger.warning(String.format(msg, kind, file, line, col, message));
View Full Code Here

          if (writer != null) {
            writer.close();
          }
        }

        File generatedFile = new File(jfo.toUri());
        generatedFile.setLastModified(entry.getValue()
            .getLastModified());
      }
    } catch (Exception ex) {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

                if ( baseMessage == null )
                {
                    continue;
                }
                JavaFileObject source = diagnostic.getSource();
                String longFileName = source == null ? null : source.toUri().getPath();
                String shortFileName = source == null ? null : source.getName();
                String formattedMessage = baseMessage;
                int lineNumber = Math.max( 0, (int) diagnostic.getLineNumber() );
                int columnNumber = Math.max( 0, (int) diagnostic.getColumnNumber() );
                if ( source != null && lineNumber > 0 )
View Full Code Here

      // Close class
      writer.append("}\n");

      //
      env.info("Generated controller companion " + fqn + "_" + " as " + file.toUri());
    }
    catch (IOException e) {
      throw ControllerMetaModel.CANNOT_WRITE_CONTROLLER_COMPANION.failure(e, origin, controller.getHandle().getName());
    }
    finally {
View Full Code Here

      // Close class
      writer.append("}\n");

      //
      env.info("Generated application " + fqn + " as " + applicationFile.toUri());
    }
    catch (IOException e) {
      throw TemplateMetaModel.CANNOT_WRITE_APPLICATION.failure(e, elt, application.getName());
    }
    finally {
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.