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:
- Closeable,- AutoCloseable
- Enclosing class:
- GroovyClassLoader
- 
Nested Class SummaryNested classes/interfaces inherited from class groovy.lang.GroovyClassLoaderGroovyClassLoader.ClassCollector, GroovyClassLoader.InnerLoader
- 
Field SummaryFields inherited from class groovy.lang.GroovyClassLoaderclassCache, sourceCache
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddClasspath(String path) adds a classpath to this classloader.voidadds a URL to the classloader.voidvoidRemoves all classes from the class cache.voidclose()Closes this GroovyClassLoader and clears any caches it maintains.defineClass(String name, byte[] b) Converts an array of bytes into an instance ofClass.defineClass(ClassNode classNode, String file, String newCodeBase) Loads the given class node returning the implementation Class.findResource(String name) findResources(String name) Class[]Returns all Groovy classes loaded by this class loader.getResource(String name) getResourceAsStream(String name) getResources(String name) longURL[]getURLs()gets the currently set recompilation mode.Class<?>loads a class from a file or a parent classloader.loads a class from a file or a parent classloader.parseClass(GroovyCodeSource codeSource) parseClass(GroovyCodeSource codeSource, boolean shouldCache) Parses the given code source into a Java class.parseClass(File file) Parses the given file into a Java class capable of being runparseClass(Reader reader, String fileName) parseClass(String text) Parses the given text into a Java class capable of being runparseClass(String text, String fileName) Parses the given text into a Java class capable of being runvoidsetClassAssertionStatus(String className, boolean enabled) voidsetDefaultAssertionStatus(boolean enabled) voidsetPackageAssertionStatus(String packageName, boolean enabled) voidsetResourceLoader(GroovyResourceLoader resourceLoader) voidsetShouldRecompile(Boolean mode) sets if the recompilation should be enabled.Methods inherited from class groovy.lang.GroovyClassLoadercreateCollector, createCompilationUnit, genEncodingString, getClassCacheEntry, getClassPath, getPermissions, getTimeStamp, hasCompatibleConfiguration, isRecompilable, isSourceNewer, loadClass, recompile, removeClassCacheEntry, setClassCacheEntryMethods inherited from class java.net.URLClassLoaderdefinePackage, findClass, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoaderdefineClass, defineClassMethods inherited from class java.lang.ClassLoaderdefineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setSigners
- 
Constructor Details- 
InnerLoader
 
- 
- 
Method Details- 
addClasspathDescription copied from class:GroovyClassLoaderadds a classpath to this classloader.- Overrides:
- addClasspathin class- GroovyClassLoader
- Parameters:
- path- is a jar file or a directory.
- See Also:
 
- 
clearCachepublic void clearCache()Description copied from class:GroovyClassLoaderRemoves 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- Overrides:
- findResourcein class- URLClassLoader
 
- 
findResources- Overrides:
- findResourcesin class- URLClassLoader
- Throws:
- IOException
 
- 
getLoadedClassesDescription copied from class:GroovyClassLoaderReturns all Groovy classes loaded by this class loader. - Overrides:
- getLoadedClassesin class- GroovyClassLoader
- Returns:
- all classes loaded by this class loader
 
- 
getResource- Overrides:
- getResourcein class- ClassLoader
 
- 
getResourceAsStream- Overrides:
- getResourceAsStreamin class- URLClassLoader
 
- 
getResourceLoader- Overrides:
- getResourceLoaderin class- GroovyClassLoader
 
- 
getURLs- Overrides:
- getURLsin class- URLClassLoader
 
- 
loadClasspublic Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve) throws ClassNotFoundException, CompilationFailedException Description copied from class:GroovyClassLoaderloads a class from a file or a parent classloader.- Overrides:
- loadClassin class- GroovyClassLoader
- Parameters:
- name- of the class to be loaded
- lookupScriptFiles- if false no lookup at files is done at all
- preferClassOverScript- if true the file lookup is only done if there is no class
- resolve- see- ClassLoader.loadClass(java.lang.String, boolean)
- Returns:
- the class found or the class created from a file lookup
- Throws:
- ClassNotFoundException- if the class could not be found
- CompilationFailedException- if the source file could not be compiled
 
- 
parseClasspublic Class parseClass(GroovyCodeSource codeSource, boolean shouldCache) throws CompilationFailedException Description copied from class:GroovyClassLoaderParses 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:
- parseClassin class- GroovyClassLoader
- 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- Overrides:
- setResourceLoaderin class- GroovyClassLoader
 
- 
addURLDescription copied from class:GroovyClassLoaderadds a URL to the classloader.- Overrides:
- addURLin class- GroovyClassLoader
- Parameters:
- url- the new classpath element
 
- 
defineClassDescription copied from class:GroovyClassLoaderLoads the given class node returning the implementation Class.WARNING: this compilation is not synchronized - Overrides:
- defineClassin class- GroovyClassLoader
- Returns:
- a class
 
- 
parseClassDescription copied from class:GroovyClassLoaderParses the given file into a Java class capable of being run- Overrides:
- parseClassin class- GroovyClassLoader
- Parameters:
- file- the file name to parse
- Returns:
- the main class defined in the given script
- Throws:
- CompilationFailedException
- IOException
 
- 
parseClassDescription copied from class:GroovyClassLoaderParses the given text into a Java class capable of being run- Overrides:
- parseClassin class- GroovyClassLoader
- Parameters:
- text- the text of the script/class to parse
- fileName- the file name to use as the name of the class
- Returns:
- the main class defined in the given script
- Throws:
- CompilationFailedException
 
- 
parseClassDescription copied from class:GroovyClassLoaderParses the given text into a Java class capable of being run- Overrides:
- parseClassin class- GroovyClassLoader
- Parameters:
- text- the text of the script/class to parse
- Returns:
- the main class defined in the given script
- Throws:
- CompilationFailedException
 
- 
generateScriptName- Overrides:
- generateScriptNamein class- GroovyClassLoader
 
- 
parseClass- Overrides:
- parseClassin class- GroovyClassLoader
- Throws:
- CompilationFailedException
 
- 
parseClass- Overrides:
- parseClassin class- GroovyClassLoader
- Throws:
- CompilationFailedException
 
- 
defineClassDescription copied from class:GroovyClassLoaderConverts an array of bytes into an instance ofClass.- Overrides:
- defineClassin class- GroovyClassLoader
 
- 
loadClasspublic Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript) throws ClassNotFoundException, CompilationFailedException Description copied from class:GroovyClassLoaderloads a class from a file or a parent classloader. This method does call loadClass(String, boolean, boolean, boolean) with the last parameter set to false.- Overrides:
- loadClassin class- GroovyClassLoader
- Throws:
- CompilationFailedException- if compilation was not successful
- ClassNotFoundException
 
- 
setShouldRecompileDescription copied from class:GroovyClassLoadersets 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.- Overrides:
- setShouldRecompilein class- GroovyClassLoader
- Parameters:
- mode- the recompilation mode
- See Also:
 
- 
isShouldRecompileDescription copied from class:GroovyClassLoadergets 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.- Overrides:
- isShouldRecompilein class- GroovyClassLoader
- Returns:
- the recompilation mode
 
- 
loadClass- Overrides:
- loadClassin class- GroovyClassLoader
- Throws:
- ClassNotFoundException
 
- 
getResources- Overrides:
- getResourcesin class- ClassLoader
- Throws:
- IOException
 
- 
setDefaultAssertionStatuspublic void setDefaultAssertionStatus(boolean enabled) - Overrides:
- setDefaultAssertionStatusin class- ClassLoader
 
- 
setPackageAssertionStatus- Overrides:
- setPackageAssertionStatusin class- ClassLoader
 
- 
setClassAssertionStatus- Overrides:
- setClassAssertionStatusin class- ClassLoader
 
- 
clearAssertionStatuspublic void clearAssertionStatus()- Overrides:
- clearAssertionStatusin class- ClassLoader
 
- 
closeDescription copied from class:GroovyClassLoaderCloses 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. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- GroovyClassLoader
- Throws:
- IOException
- See Also:
 
- 
getTimeStamppublic long getTimeStamp()
 
-