Class GroovyEngine.EngineClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
GroovyEngine

public static class GroovyEngine.EngineClassLoader extends GroovyClassLoader
Custom class loader for dynamically loaded Groovy classes. Extends GroovyClassLoader with cache purging capabilities.
  • Constructor Details

    • EngineClassLoader

      public EngineClassLoader()
      Constructs a new EngineClassLoader.
    • EngineClassLoader

      @Incubating public EngineClassLoader(CompilerConfiguration configuration)
      Constructs an EngineClassLoader with the given compiler configuration and the current thread's context class loader as parent.
      Parameters:
      configuration - compiler configuration, or null for the default
      Since:
      7.0.0
    • EngineClassLoader

      @Incubating public EngineClassLoader(ClassLoader parent)
      Constructs an EngineClassLoader with the given parent class loader and CompilerConfiguration.DEFAULT. Use EngineClassLoader(ClassLoader, CompilerConfiguration) to supply an engine's configuration, so that the engine adopts this loader rather than wrapping it.
      Parameters:
      parent - the parent class loader
      Since:
      7.0.0
    • EngineClassLoader

      @Incubating public EngineClassLoader(ClassLoader parent, CompilerConfiguration configuration)
      Constructs an EngineClassLoader with the given parent class loader and compiler configuration.
      Parameters:
      parent - the parent class loader
      configuration - compiler configuration, or null for the default
      Since:
      7.0.0
  • Method Details

    • getPackages

      public Package[] getPackages()
      Returns all packages loaded by this class loader.
      Overrides:
      getPackages in class ClassLoader
      Returns:
      array of packages
    • purgeClassCache

      public void purgeClassCache(String regex)
      Purges cached classes matching the given regex pattern.
      Parameters:
      regex - the pattern to match class names
    • purgeClassCache

      public void purgeClassCache()
      Purges all dynamically generated script classes from the cache.