Package io.micronaut.ast.groovy.utils
Class InMemoryByteCodeGroovyClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
groovy.lang.GroovyClassLoader
io.micronaut.ast.groovy.utils.InMemoryByteCodeGroovyClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
Extended version of
GroovyClassLoader
that can be used to test dependency injection compilation.- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Nested classes/interfaces inherited from class groovy.lang.GroovyClassLoader
groovy.lang.GroovyClassLoader.ClassCollector, groovy.lang.GroovyClassLoader.InnerLoader
-
Field Summary
Fields inherited from class groovy.lang.GroovyClassLoader
classCache, sourceCache
-
Constructor Summary
ConstructorDescriptionDefault constructor.InMemoryByteCodeGroovyClassLoader
(groovy.lang.GroovyClassLoader parent) InMemoryByteCodeGroovyClassLoader
(ClassLoader loader, org.codehaus.groovy.control.CompilerConfiguration config) InMemoryByteCodeGroovyClassLoader
(ClassLoader parent, org.codehaus.groovy.control.CompilerConfiguration config, boolean useConfigurationClasspath) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addService
(String name, Set<String> classes) Adds one or many services that can be loaded viaServiceLoader
.findResources
(String name) Class<?>
Methods inherited from class groovy.lang.GroovyClassLoader
addClasspath, addURL, clearCache, close, createCollector, createCompilationUnit, defineClass, defineClass, genEncodingString, generateScriptName, getClassCacheEntry, getClassPath, getLoadedClasses, getPermissions, getResourceLoader, getTimeStamp, hasCompatibleConfiguration, isRecompilable, isShouldRecompile, isSourceNewer, loadClass, loadClass, loadClass, parseClass, parseClass, parseClass, parseClass, parseClass, parseClass, recompile, removeClassCacheEntry, setClassCacheEntry, setResourceLoader, setShouldRecompile
Methods inherited from class java.net.URLClassLoader
definePackage, findClass, findResource, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
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, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
InMemoryByteCodeGroovyClassLoader
public InMemoryByteCodeGroovyClassLoader()Default constructor. -
InMemoryByteCodeGroovyClassLoader
- Parameters:
loader
- TheClassLoader
-
InMemoryByteCodeGroovyClassLoader
public InMemoryByteCodeGroovyClassLoader(groovy.lang.GroovyClassLoader parent) - Parameters:
parent
- TheGroovyClassLoader
-
InMemoryByteCodeGroovyClassLoader
public InMemoryByteCodeGroovyClassLoader(ClassLoader parent, org.codehaus.groovy.control.CompilerConfiguration config, boolean useConfigurationClasspath) - Parameters:
parent
- The parentClassLoader
config
- TheCompilerConfiguration
useConfigurationClasspath
- Whether to use the configuration classpath
-
InMemoryByteCodeGroovyClassLoader
public InMemoryByteCodeGroovyClassLoader(ClassLoader loader, org.codehaus.groovy.control.CompilerConfiguration config) - Parameters:
loader
- TheClassLoader
config
- TheCompilerConfiguration
-
-
Method Details
-
addClass
- Parameters:
name
- The name of the classcode
- The code
-
addService
Adds one or many services that can be loaded viaServiceLoader
.- Parameters:
name
- The name of the serviceclasses
- The classes- Throws:
MalformedURLException
- If the name is not valid
-
loadClass
- Overrides:
loadClass
in classgroovy.lang.GroovyClassLoader
- Throws:
ClassNotFoundException
-
findResources
- Overrides:
findResources
in classURLClassLoader
- Throws:
IOException
-
getGeneratedClasses
-