Пример #1
0
 /**
  * Parses the given text into a Java class capable of being run
  *
  * @param text the text of the script/class to parse
  * @param fileName the file name to use as the name of the class
  * @return the main class defined in the given script
  */
 public Class parseClass(final String text, final String fileName)
     throws CompilationFailedException {
   GroovyCodeSource gcs =
       AccessController.doPrivileged(
           new PrivilegedAction<GroovyCodeSource>() {
             public GroovyCodeSource run() {
               return new GroovyCodeSource(text, fileName, "/groovy/script");
             }
           });
   gcs.setCachable(false);
   return parseClass(gcs);
 }