public static class GroovyClassLoader.InnerLoader extends GroovyClassLoader
GroovyClassLoader.ClassCollector, GroovyClassLoader.InnerLoader
classCache, sourceCache
Constructor and Description |
---|
InnerLoader(GroovyClassLoader delegate) |
Modifier and Type | Method and Description |
---|---|
void |
addClasspath(String path)
adds a classpath to this classloader.
|
void |
addURL(URL url)
adds a URL to the classloader.
|
void |
clearAssertionStatus() |
void |
clearCache()
Removes all classes from the class cache.
|
void |
close()
Closes this GroovyClassLoader and clears any caches it maintains.
|
Class |
defineClass(ClassNode classNode,
String file,
String newCodeBase)
Loads the given class node returning the implementation Class.
|
Class |
defineClass(String name,
byte[] b)
open up the super class define that takes raw bytes
|
URL |
findResource(String name) |
Enumeration<URL> |
findResources(String name) |
String |
generateScriptName() |
Class[] |
getLoadedClasses()
Returns all Groovy classes loaded by this class loader.
|
URL |
getResource(String name) |
InputStream |
getResourceAsStream(String name) |
GroovyResourceLoader |
getResourceLoader() |
Enumeration<URL> |
getResources(String name) |
long |
getTimeStamp() |
URL[] |
getURLs() |
Boolean |
isShouldRecompile()
gets the currently set recompilation mode.
|
Class<?> |
loadClass(String name) |
Class |
loadClass(String name,
boolean lookupScriptFiles,
boolean preferClassOverScript)
loads a class from a file or a parent classloader.
|
Class |
loadClass(String name,
boolean lookupScriptFiles,
boolean preferClassOverScript,
boolean resolve)
loads a class from a file or a parent classloader.
|
Class |
parseClass(File file)
Parses the given file into a Java class capable of being run
|
Class |
parseClass(GroovyCodeSource codeSource) |
Class |
parseClass(GroovyCodeSource codeSource,
boolean shouldCache)
Parses the given code source into a Java class.
|
Class |
parseClass(InputStream in,
String fileName)
Deprecated.
|
Class |
parseClass(Reader reader,
String fileName) |
Class |
parseClass(String text)
Parses the given text into a Java class capable of being run
|
Class |
parseClass(String text,
String fileName)
Parses the given text into a Java class capable of being run
|
void |
setClassAssertionStatus(String className,
boolean enabled) |
void |
setDefaultAssertionStatus(boolean enabled) |
void |
setPackageAssertionStatus(String packageName,
boolean enabled) |
void |
setResourceLoader(GroovyResourceLoader resourceLoader) |
void |
setShouldRecompile(Boolean mode)
sets if the recompilation should be enable.
|
createCollector, createCompilationUnit, getClassCacheEntry, getClassPath, getPermissions, getTimeStamp, hasCompatibleConfiguration, isRecompilable, isSourceNewer, loadClass, recompile, removeClassCacheEntry, setClassCacheEntry
definePackage, findClass, newInstance, newInstance
defineClass, defineClass
defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setSigners
public InnerLoader(GroovyClassLoader delegate)
public void addClasspath(String path)
GroovyClassLoader
addClasspath
in class GroovyClassLoader
path
- is a jar file or a directory.GroovyClassLoader.addURL(URL)
public void clearCache()
GroovyClassLoader
In addition to internal caches this method also clears any previously set MetaClass information for the given set of classes being removed.
public URL findResource(String name)
findResource
in class URLClassLoader
public Enumeration<URL> findResources(String name) throws IOException
findResources
in class URLClassLoader
IOException
public Class[] getLoadedClasses()
GroovyClassLoader
Returns all Groovy classes loaded by this class loader.
getLoadedClasses
in class GroovyClassLoader
public URL getResource(String name)
getResource
in class ClassLoader
public InputStream getResourceAsStream(String name)
getResourceAsStream
in class URLClassLoader
public GroovyResourceLoader getResourceLoader()
getResourceLoader
in class GroovyClassLoader
public URL[] getURLs()
getURLs
in class URLClassLoader
public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve) throws ClassNotFoundException, CompilationFailedException
GroovyClassLoader
loadClass
in class GroovyClassLoader
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.loadClass(java.lang.String, boolean)
ClassNotFoundException
- if the class could not be foundCompilationFailedException
- if the source file could not be compiledpublic Class parseClass(GroovyCodeSource codeSource, boolean shouldCache) throws CompilationFailedException
GroovyClassLoader
parseClass
in class GroovyClassLoader
shouldCache
- if true then the generated class will be stored in the source cacheCompilationFailedException
public void setResourceLoader(GroovyResourceLoader resourceLoader)
setResourceLoader
in class GroovyClassLoader
public void addURL(URL url)
GroovyClassLoader
addURL
in class GroovyClassLoader
url
- the new classpath elementpublic Class defineClass(ClassNode classNode, String file, String newCodeBase)
GroovyClassLoader
WARNING: this compilation is not synchronized
defineClass
in class GroovyClassLoader
public Class parseClass(File file) throws CompilationFailedException, IOException
GroovyClassLoader
parseClass
in class GroovyClassLoader
file
- the file name to parseCompilationFailedException
IOException
public Class parseClass(String text, String fileName) throws CompilationFailedException
GroovyClassLoader
parseClass
in class GroovyClassLoader
text
- the text of the script/class to parsefileName
- the file name to use as the name of the classCompilationFailedException
public Class parseClass(String text) throws CompilationFailedException
GroovyClassLoader
parseClass
in class GroovyClassLoader
text
- the text of the script/class to parseCompilationFailedException
public String generateScriptName()
generateScriptName
in class GroovyClassLoader
public Class parseClass(Reader reader, String fileName) throws CompilationFailedException
parseClass
in class GroovyClassLoader
CompilationFailedException
@Deprecated public Class parseClass(InputStream in, String fileName) throws CompilationFailedException
parseClass
in class GroovyClassLoader
CompilationFailedException
public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException
parseClass
in class GroovyClassLoader
CompilationFailedException
public Class defineClass(String name, byte[] b)
GroovyClassLoader
defineClass
in class GroovyClassLoader
public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript) throws ClassNotFoundException, CompilationFailedException
GroovyClassLoader
loadClass
in class GroovyClassLoader
CompilationFailedException
- if compilation was not successfulClassNotFoundException
public void setShouldRecompile(Boolean mode)
GroovyClassLoader
setShouldRecompile
in class GroovyClassLoader
mode
- the recompilation modeCompilerConfiguration
public Boolean isShouldRecompile()
GroovyClassLoader
isShouldRecompile
in class GroovyClassLoader
public Class<?> loadClass(String name) throws ClassNotFoundException
loadClass
in class GroovyClassLoader
ClassNotFoundException
public Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
IOException
public void setDefaultAssertionStatus(boolean enabled)
setDefaultAssertionStatus
in class ClassLoader
public void setPackageAssertionStatus(String packageName, boolean enabled)
setPackageAssertionStatus
in class ClassLoader
public void setClassAssertionStatus(String className, boolean enabled)
setClassAssertionStatus
in class ClassLoader
public void clearAssertionStatus()
clearAssertionStatus
in class ClassLoader
public void close() throws IOException
GroovyClassLoader
No use should be made of this instance after this method is invoked. Any classes that are already loaded are still accessible.
close
in interface Closeable
close
in interface AutoCloseable
close
in class GroovyClassLoader
IOException
URLClassLoader.close()
,
GroovyClassLoader.clearCache()
public long getTimeStamp()