Examples of JavaFileObject


Examples of javax.tools.JavaFileObject

                // if there remain any unimported toplevels (these must have
                // no classes at all), process their import statements as well.
                for (JCCompilationUnit tree : trees) {
                    if (tree.starImportScope.elems == null) {
                        JavaFileObject prev = log.useSource(tree.sourcefile);
                        Env<AttrContext> topEnv = topLevelEnv(tree);
                        memberEnter.memberEnter(tree, topEnv);
                        log.useSource(prev);
                    }
                }
View Full Code Here

Examples of javax.tools.JavaFileObject

                                                                      Charsets.US_ASCII),
                                  outFs);
    String className = classBase + compilationVersion;

    try {
      JavaFileObject compilationUnit = javaFileManager.getJavaFileForInput(
          StandardLocation.SOURCE_PATH, className, JavaFileObject.Kind.SOURCE);

      Iterable<JavaFileObject> compilationUnits = ImmutableList.of(compilationUnit);

      javaCompiler.getTask(null, javaFileManager, diagnosticCollector,
View Full Code Here

Examples of javax.tools.JavaFileObject

    *      javax.tools.FileObject)
    */
   @Override
   public JavaFileObject getJavaFileForOutput(Location location, String qualifiedName,
         Kind kind, FileObject outputFile) throws IOException {
      JavaFileObject file = new JavaFileObjectImpl(qualifiedName, kind);
      classLoader.add(qualifiedName, file);
      return file;
   }
View Full Code Here

Examples of javax.tools.JavaFileObject

   }

   @Override
   protected Class<?> findClass(final String qualifiedClassName)
         throws ClassNotFoundException {
      JavaFileObject file = classes.get(qualifiedClassName);
      if (file != null) {
         byte[] bytes = ((JavaFileObjectImpl) file).getByteCode();
         return defineClass(qualifiedClassName, bytes, 0, bytes.length);
      }
      // Workaround for "feature" in Java 6
View Full Code Here

Examples of javax.tools.JavaFileObject

    private void writeGinjectorFile() throws Exception {
        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

Examples of javax.tools.JavaFileObject

        output.close();

    }

    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

Examples of javax.tools.JavaFileObject

    private void writeBeanFactoryFile() throws Exception {
        Map<String, Object> model = new HashMap<String,Object>();
        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

Examples of javax.tools.JavaFileObject

    private void writeSubsystemFile() throws Exception {
        Map<String, Object> model = new HashMap<String,Object>();
        model.put("subsystemExtensions", subsystemDeclararions);

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

Examples of javax.tools.JavaFileObject

    private void writeRuntimeFile() throws Exception {
        Map<String, Object> model = new HashMap<String,Object>();
        model.put("runtimeMenuItemExtensions", runtimeExtensions);

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

Examples of javax.tools.JavaFileObject

                env.getElementsAnnotatedWith(annotationType);
            elements.addAll(annotated);
        }
        if (elements.isEmpty() == false) {
            try {
                JavaFileObject file =
                    processingEnv.getFiler().createSourceFile("Generated");
                Writer writer = file.openWriter();
                PrintWriter pw = new PrintWriter(writer);
                pw.println("public class Generated {");
                pw.println("    public static final String[] ELEMENTS = {");
                for (Element element : elements) {
                    pw.println("        \"" + element.getSimpleName() + "\",");
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.