public static class GroovyClassLoader.InnerLoader
extends GroovyClassLoader
Loader used while defining classes during a compilation round.
| Fields inherited from class | Fields |
|---|---|
class GroovyClassLoader |
classCache, sourceCache |
| Constructor and description |
|---|
InnerLoader(GroovyClassLoader delegate)Creates an inner loader delegating to the supplied outer Groovy class loader. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addClasspath(String path)adds a classpath to this classloader.
|
|
public void |
addURL(URL url)adds a URL to the classloader.
|
|
public void |
clearAssertionStatus(){@inheritDoc} |
|
public void |
clearCache()Removes all classes from the class cache. In addition to internal caches this method also clears any previously set MetaClass information for the given set of classes being removed. |
|
public void |
close()Closes this GroovyClassLoader and clears any caches it maintains. No use should be made of this instance after this method is invoked. Any classes that are already loaded are still accessible.
|
|
public Class |
defineClass(ClassNode classNode, String file, String newCodeBase)Compiles the given ClassNode returning the resulting Class.
WARNING: compilation is not synchronized |
|
public Class |
defineClass(String name, byte[] b)Converts an array of bytes into an instance of Class. Before the
class can be used it must be resolved.
|
|
public URL |
findResource(String name){@inheritDoc} |
|
public Enumeration<URL> |
findResources(String name){@inheritDoc} |
|
public String |
generateScriptName()Generates a unique script name for unnamed parsed sources.
|
|
public Class[] |
getLoadedClasses()Returns all Groovy classes loaded by this class loader.
|
|
public URL |
getResource(String name){@inheritDoc} |
|
public InputStream |
getResourceAsStream(String name){@inheritDoc} |
|
public GroovyResourceLoader |
getResourceLoader()Returns the resource loader used to resolve Groovy source by script name.
|
|
public Enumeration<URL> |
getResources(String name){@inheritDoc} |
|
public long |
getTimeStamp()Returns the creation timestamp of this inner loader. |
|
public URL[] |
getURLs(){@inheritDoc} |
|
public Boolean |
isShouldRecompile()gets the currently set recompilation mode. null means, the compiler configuration is used. False means no recompilation and true means that recompilation will be done if needed.
|
|
public Class<?> |
loadClass(String name){@inheritDoc}
|
|
public Class |
loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript)Loads a class from a file or a parent loader. This method delegates to:
|
|
public Class |
loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve)Loads a class from a file or a parent loader.
|
|
public Class |
parseClass(File file)Parses the given file into a Java class capable of being run
|
|
public Class |
parseClass(GroovyCodeSource codeSource)Parses Groovy source described by a GroovyCodeSource.
|
|
public Class |
parseClass(GroovyCodeSource codeSource, boolean shouldCache)Parses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned.
|
|
public Class |
parseClass(Reader reader, String fileName)Parses Groovy source read from a Reader.
|
|
public Class |
parseClass(String text)Parses the given text into a Java class capable of being run
|
|
public Class |
parseClass(String text, String fileName)Parses the given text into a Java class capable of being run
|
|
public void |
setClassAssertionStatus(String className, boolean enabled){@inheritDoc} |
|
public void |
setDefaultAssertionStatus(boolean enabled){@inheritDoc} |
|
public void |
setPackageAssertionStatus(String packageName, boolean enabled){@inheritDoc} |
|
public void |
setResourceLoader(GroovyResourceLoader resourceLoader)Sets the resource loader used to resolve Groovy source by script name.
|
|
public void |
setShouldRecompile(Boolean mode)sets if the recompilation should be enabled. There are 3 possible values for this. Any value different from null overrides the value from the compiler configuration. true means to recompile if needed false means to never recompile.
|
| Methods inherited from class | Name |
|---|---|
class GroovyClassLoader |
addClasspath, addURL, clearCache, close, createCollector, createCompilationUnit, defineClass, defineClass, genEncodingString, generateScriptName, getClassCacheEntry, getClassPath, getLoadedClasses, getPermissions, getResourceLoader, getTimeStamp, hasCompatibleConfiguration, isRecompilable, isShouldRecompile, isSourceNewer, loadClass, loadClass, loadClass, loadClass, parseClass, parseClass, parseClass, parseClass, parseClass, parseClass, recompile, removeClassCacheEntry, setClassCacheEntry, setResourceLoader, setShouldRecompile |
Creates an inner loader delegating to the supplied outer Groovy class loader.
delegate - the outer loader that owns caches and resourcesadds a classpath to this classloader.
path - is a jar file or a directory.adds a URL to the classloader.
url - the new classpath element{@inheritDoc}
Removes all classes from the class cache.
In addition to internal caches this method also clears any previously set MetaClass information for the given set of classes being removed.
Closes this GroovyClassLoader and clears any caches it maintains.
No use should be made of this instance after this method is invoked. Any classes that are already loaded are still accessible.
Compiles the given ClassNode returning the resulting Class.
WARNING: compilation is not synchronized
Converts an array of bytes into an instance of Class. Before the
class can be used it must be resolved.
{@inheritDoc}
Generates a unique script name for unnamed parsed sources.
.groovy
Returns all Groovy classes loaded by this class loader.
{@inheritDoc}
Returns the resource loader used to resolve Groovy source by script name.
{@inheritDoc}
Returns the creation timestamp of this inner loader.
{@inheritDoc}
gets the currently set recompilation mode. null means, the compiler configuration is used. False means no recompilation and true means that recompilation will be done if needed.
{@inheritDoc}
Loads a class from a file or a parent loader. This method delegates to:
loadClass(name, lookupScriptFiles, preferClassOverScript, false);
Loads a class from a file or a parent loader.
name - of the class to be loadedlookupScriptFiles - if false no lookup at files is done at allpreferClassOverScript - if true the file lookup is only done if there is no classresolve - see ClassLoader.loadClassParses the given file into a Java class capable of being run
file - the file name to parseParses Groovy source described by a GroovyCodeSource.
codeSource - the code source to compileParses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned.
shouldCacheSource - if true then the generated class will be stored in the source cacheParses Groovy source read from a Reader.
reader - the reader supplying source textfileName - the logical script nameParses the given text into a Java class capable of being run
text - the text of the script/class to parseParses the given text into a Java class capable of being run
text - the text of the script/class to parsefileName - the file name to use as the name of the class{@inheritDoc}
{@inheritDoc}
{@inheritDoc}
Sets the resource loader used to resolve Groovy source by script name.
resourceLoader - the resource loader to usesets if the recompilation should be enabled. There are 3 possible values for this. Any value different from null overrides the value from the compiler configuration. true means to recompile if needed false means to never recompile.
mode - the recompilation modeCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.