Package groovy.lang
Class GroovyClassLoader.InnerLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- groovy.lang.GroovyClassLoader
-
- groovy.lang.GroovyClassLoader.InnerLoader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- GroovyClassLoader
public static class GroovyClassLoader.InnerLoader extends GroovyClassLoader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class groovy.lang.GroovyClassLoader
GroovyClassLoader.ClassCollector, GroovyClassLoader.InnerLoader
-
-
Field Summary
-
Fields inherited from class groovy.lang.GroovyClassLoader
classCache, sourceCache
-
-
Constructor Summary
Constructors Constructor Description InnerLoader(GroovyClassLoader delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClasspath(java.lang.String path)
adds a classpath to this classloader.void
addURL(java.net.URL url)
adds a URL to the classloader.void
clearCache()
Removes all classes from the class cache.java.net.URL
findResource(java.lang.String name)
java.util.Enumeration
findResources(java.lang.String name)
java.lang.Class[]
getLoadedClasses()
Returns all Groovy classes loaded by this class loader.java.net.URL
getResource(java.lang.String name)
java.io.InputStream
getResourceAsStream(java.lang.String name)
GroovyResourceLoader
getResourceLoader()
long
getTimeStamp()
java.net.URL[]
getURLs()
java.lang.Class
loadClass(java.lang.String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve)
loads a class from a file or a parent classloader.java.lang.Class
parseClass(GroovyCodeSource codeSource, boolean shouldCache)
Parses the given code source into a Java class.void
setResourceLoader(GroovyResourceLoader resourceLoader)
-
Methods inherited from class groovy.lang.GroovyClassLoader
close, createCollector, createCompilationUnit, defineClass, defineClass, generateScriptName, getClassCacheEntry, getClassPath, getPermissions, getTimeStamp, hasCompatibleConfiguration, isRecompilable, isShouldRecompile, isSourceNewer, loadClass, loadClass, loadClass, parseClass, parseClass, parseClass, parseClass, parseClass, parseClass, recompile, removeClassCacheEntry, setClassCacheEntry, setShouldRecompile
-
Methods inherited from class java.net.URLClassLoader
definePackage, findClass, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
InnerLoader
public InnerLoader(GroovyClassLoader delegate)
-
-
Method Detail
-
addClasspath
public void addClasspath(java.lang.String path)
Description copied from class:GroovyClassLoader
adds a classpath to this classloader.- Overrides:
addClasspath
in classGroovyClassLoader
- Parameters:
path
- is a jar file or a directory.- See Also:
GroovyClassLoader.addURL(URL)
-
clearCache
public void clearCache()
Description copied from class:GroovyClassLoader
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.
-
findResource
public java.net.URL findResource(java.lang.String name)
- Overrides:
findResource
in classjava.net.URLClassLoader
-
findResources
public java.util.Enumeration findResources(java.lang.String name) throws java.io.IOException
- Overrides:
findResources
in classjava.net.URLClassLoader
- Throws:
java.io.IOException
-
getLoadedClasses
public java.lang.Class[] getLoadedClasses()
Description copied from class:GroovyClassLoader
Returns all Groovy classes loaded by this class loader.
- Overrides:
getLoadedClasses
in classGroovyClassLoader
- Returns:
- all classes loaded by this class loader
-
getResource
public java.net.URL getResource(java.lang.String name)
- Overrides:
getResource
in classjava.lang.ClassLoader
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String name)
- Overrides:
getResourceAsStream
in classjava.net.URLClassLoader
-
getResourceLoader
public GroovyResourceLoader getResourceLoader()
- Overrides:
getResourceLoader
in classGroovyClassLoader
-
getURLs
public java.net.URL[] getURLs()
- Overrides:
getURLs
in classjava.net.URLClassLoader
-
loadClass
public java.lang.Class loadClass(java.lang.String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve) throws java.lang.ClassNotFoundException, CompilationFailedException
Description copied from class:GroovyClassLoader
loads a class from a file or a parent classloader.- Overrides:
loadClass
in classGroovyClassLoader
- Parameters:
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
- seeClassLoader.loadClass(java.lang.String, boolean)
- Returns:
- the class found or the class created from a file lookup
- Throws:
java.lang.ClassNotFoundException
- if the class could not be foundCompilationFailedException
- if the source file could not be compiled
-
parseClass
public java.lang.Class parseClass(GroovyCodeSource codeSource, boolean shouldCache) throws CompilationFailedException
Description copied from class:GroovyClassLoader
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.- Overrides:
parseClass
in classGroovyClassLoader
shouldCache
- if true then the generated class will be stored in the source cache- Returns:
- the main class defined in the given script
- Throws:
CompilationFailedException
-
setResourceLoader
public void setResourceLoader(GroovyResourceLoader resourceLoader)
- Overrides:
setResourceLoader
in classGroovyClassLoader
-
addURL
public void addURL(java.net.URL url)
Description copied from class:GroovyClassLoader
adds a URL to the classloader.- Overrides:
addURL
in classGroovyClassLoader
- Parameters:
url
- the new classpath element
-
getTimeStamp
public long getTimeStamp()
-
-