Package groovy.lang

Examples of groovy.lang.GroovyClassLoader$ClassCollector


                    "    }\n" +
                    "    return v\n" +
                    "  }\n" +
                    "}";

            GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader());
            groovyClass = loader.parseClass(groovyString);
            try {
                match = groovyClass.getDeclaredMethod("match");
                metaField = groovyClass.getField("meta");
            } catch (NoSuchFieldException e) {
                // can never occur as we control the groovy string
View Full Code Here


            Class<GroovyClassLoader> classLoaderClass = annotationFinder().getAnnotatedValue(UsingGroovy.class,
                    Class.class, "classLoader");
            Class<GroovyResourceFinder> resourceFinderClass = annotationFinder().getAnnotatedValue(UsingGroovy.class,
                    Class.class, "resourceFinder");
            try {
                GroovyClassLoader classLoader = super.instanceOf(classLoaderClass, classLoaderClass);
                GroovyResourceFinder resourceFinder = super.instanceOf(resourceFinderClass, resourceFinderClass);
                context = createGroovyContext(classLoader, resourceFinder);
            } catch (Exception e) {
                annotationMonitor().elementCreationFailed(GroovyContext.class, e);
            }
View Full Code Here

public class BytecodeGroovyClassLoaderBehaviour {

    @Test
    public void shouldCacheBytes() throws IOException {
        GroovyClassLoader classLoader = new BytecodeGroovyClassLoader();
        assertNotNull((Class<?>) classLoader.parseClass("class Hello { }"));
        InputStream bytecode = classLoader.getResourceAsStream("Hello.class");
        assertNotNull(bytecode);
        bytecode.close();
    }
View Full Code Here

   @Override
   public ClassLoader getClassLoader()
   {
      if (classLoader == null && super.getClassLoader() != null)
      {
         this.classLoader = new GroovyClassLoader(super.getClassLoader());
      }
      return classLoader;
   }
View Full Code Here

  public CompiledScript compile(String scriptName, String scriptCode) throws ScriptCompilerException
  {
    try
    {
      GroovyClassLoader gcl = new GroovyClassLoader();
      Class scriptClass = gcl.parseClass(scriptCode);
      if (scriptClass == null)
      {
        throw new ScriptCompilerException("No compiled script code in script \"" + scriptName + "\"");
      }
      return new CompiledGroovyScript(scriptName, gcl.parseClass(scriptCode));
    }
    catch (CompilationFailedException x)
    {
      throw new ScriptCompilerException("Unable to compile script", x);
    }
View Full Code Here

  {
    try
    {
//      GroovyShell gs = new GroovyShell();
//      gs.parse(scriptCode);
      GroovyClassLoader gcl = new GroovyClassLoader();
      Class scriptClass = gcl.parseClass(scriptCode);
      if (scriptClass == null)
      {
        throw new ScriptCompilerException("No compiled script code");
      }
    }
View Full Code Here

            throw new GeneralException("Error loading Groovy script at [" + location + "]: ", e);
        }
    }

    public static Class<?> loadClass(String path) throws ClassNotFoundException {
        return new GroovyClassLoader().loadClass(path);
    }
View Full Code Here

    public static Class<?> loadClass(String path) throws ClassNotFoundException {
        return new GroovyClassLoader().loadClass(path);
    }

    public static Class<?> parseClass(InputStream in, String location) throws IOException {
        return new GroovyClassLoader().parseClass(UtilIO.readString(in), location);
    }
View Full Code Here

    public static Class<?> parseClass(InputStream in, String location) throws IOException {
        return new GroovyClassLoader().parseClass(UtilIO.readString(in), location);
    }

    public static Class<?> parseClass(String text) {
        return new GroovyClassLoader().parseClass(text);
    }
View Full Code Here

    public static Class<?> parseClass(String text) {
        return new GroovyClassLoader().parseClass(text);
    }

    public static Class<?> parseClass(String text, String location) {
        return new GroovyClassLoader().parseClass(text, location);
    }
View Full Code Here

TOP

Related Classes of groovy.lang.GroovyClassLoader$ClassCollector

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.