Package javax.tools

Examples of javax.tools.SimpleJavaFileObject


                    }
                };

        //read java source code from memory
        String fileName = className.replace('.', '/') + ".java";
        SimpleJavaFileObject sourceCodeObject = new SimpleJavaFileObject(toURI(fileName), JavaFileObject.Kind.SOURCE) {
            @Override
            public CharSequence getCharContent(boolean
                    ignoreEncodingErrors)
                    throws IOException, IllegalStateException,
                    UnsupportedOperationException {
View Full Code Here


    try {
      uri = new URI("drill-class-compiler");
    } catch (URISyntaxException use) {
      throw new RuntimeException(use);
    }
    JavaFileObject javaFileObject = new SimpleJavaFileObject(uri, Kind.SOURCE) {

      @Override
      public boolean isNameCompatible(String simpleName, Kind kind) {
        return true;
      }
View Full Code Here

                    }
                };

        //read java source code from memory
        String fileName = className.replace('.', '/') + ".java";
        SimpleJavaFileObject sourceCodeObject = new SimpleJavaFileObject(toURI(fileName), JavaFileObject.Kind.SOURCE) {
            @Override
            public CharSequence getCharContent(boolean
                    ignoreEncodingErrors)
                    throws IOException, IllegalStateException,
                    UnsupportedOperationException {
View Full Code Here

                    }
                };

        //read java source code from memory
        String fileName = className.replace('.', '/') + ".java";
        SimpleJavaFileObject sourceCodeObject = new SimpleJavaFileObject(toURI(fileName), JavaFileObject.Kind.SOURCE) {
            @Override
            public CharSequence getCharContent(boolean
                    ignoreEncodingErrors)
                    throws IOException, IllegalStateException,
                    UnsupportedOperationException {
View Full Code Here

                    }
                };

        //read java source code from memory
        String fileName = className.replace('.', '/') + ".java";
        SimpleJavaFileObject sourceCodeObject = new SimpleJavaFileObject(toURI(fileName), JavaFileObject.Kind.SOURCE) {
            @Override
            public CharSequence getCharContent(boolean
                    ignoreEncodingErrors)
                    throws IOException, IllegalStateException,
                    UnsupportedOperationException {
View Full Code Here

    }

    @Override
    public JavaFileObject getJavaFileForOutput(Location location, final String className,
        JavaFileObject.Kind kind, FileObject sibling) throws IOException {
      return new SimpleJavaFileObject(EMPTY_URI, kind) {
        @Override
        public OutputStream openOutputStream() throws IOException {
          ByteArrayOutputStream outputStream = byteCodeForClasses.get(className);
          if (outputStream != null) {
            throw new IllegalStateException("Cannot write more than once");
View Full Code Here

      }
      code += "}";

      System.err.println("CODE: " + code);

      SimpleJavaFileObject fileObject = new DynamicJavaSourceCodeObject( name, code );

      // new DynamicJavaSourceCodeObject
      // ("com.accordess.ca.DynamicCompilationHelloWorld", sourceCode) ;
      JavaFileObject javaFileObjects[] = new JavaFileObject[] { fileObject };
View Full Code Here

                    javac.getStandardFileManager(diagnostics, null, null);

        String name = className.substring(className.lastIndexOf('.')+1);

        JavaFileObject[] sourceFiles = {
            new SimpleJavaFileObject(
                    URI.create("string:///" + name.replace('.','/') +
                               Kind.SOURCE.extension),
                    Kind.SOURCE) {
                public CharSequence getCharContent(boolean ignore) {
                    return source;
View Full Code Here

  @Override
  public JavaFileObject getJavaFileForOutput(Location location, final String className,
                                             JavaFileObject.Kind kind, FileObject sibling) throws IOException {
    try {
      return new SimpleJavaFileObject(new URI(""), kind) {
        public OutputStream openOutputStream() throws IOException {
          ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
          compiledClasses.put(className, outputStream);
          return outputStream;
        }
View Full Code Here

import static javax.tools.JavaFileObject.Kind;

public class T6852595 {
    public static void main(String[] args) throws IOException {
        JavaFileObject sfo = new SimpleJavaFileObject(URI.create("myfo:/Test.java"),Kind.SOURCE) {
            public CharSequence getCharContent(boolean ignoreEncodingErrors) {
                return "class BadName { Object o = j; }";
            }
        };
        List<? extends JavaFileObject> files = Arrays.asList(sfo);
View Full Code Here

TOP

Related Classes of javax.tools.SimpleJavaFileObject

Copyright © 2018 www.massapicom. 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.