|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
groovy.lang.GroovyClassLoader
A ClassLoader which can load Groovy classes
Nested Class Summary | |
static class |
GroovyClassLoader.ClassCollector
|
static class |
GroovyClassLoader.PARSING
|
Constructor Summary | |
GroovyClassLoader()
creates a GroovyClassLoader using the current Thread's context Class loader as parent. |
|
GroovyClassLoader(ClassLoader loader)
creates a GroovyClassLoader using the given ClassLoader as parent |
|
GroovyClassLoader(ClassLoader loader,
CompilerConfiguration config)
creates a GroovyClassLoader using the given ClassLoader as parent. |
|
GroovyClassLoader(GroovyClassLoader parent)
creates a GroovyClassLoader using the given GroovyClassLoader as parent. |
Method Summary | |
void |
addClasspath(String path)
|
protected GroovyClassLoader.ClassCollector |
createCollector(CompilationUnit unit,
SourceUnit su)
|
Class |
defineClass(ClassNode classNode,
String file)
Loads the given class node returning the implementation Class |
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 |
protected Class |
defineClass(String name,
byte[] bytecode,
ProtectionDomain domain)
A helper method to allow bytecode to be loaded. |
protected void |
expandClassPath(List pathList,
String base,
String classpath,
boolean isManifestClasspath)
|
protected String[] |
getClassPath()
Workaround for Groovy-835 |
Class[] |
getLoadedClasses()
Returns all Groovy classes loaded by this class loader. |
GroovyResourceLoader |
getResourceLoader()
|
protected Class |
loadClass(String name,
boolean resolve)
Implemented here to check package access prior to returning an already loaded class. |
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 capable of being run |
Class |
parseClass(InputStream in)
Parses the given character stream into a Java class capable of being run |
Class |
parseClass(InputStream in,
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 |
removeFromCache(Class aClass)
|
void |
setResourceLoader(GroovyResourceLoader resourceLoader)
|
Methods inherited from class java.security.SecureClassLoader |
defineClass, getPermissions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GroovyClassLoader()
public GroovyClassLoader(ClassLoader loader)
public GroovyClassLoader(GroovyClassLoader parent)
public GroovyClassLoader(ClassLoader loader, CompilerConfiguration config)
Method Detail |
public void removeFromCache(Class aClass)
public void setResourceLoader(GroovyResourceLoader resourceLoader)
public GroovyResourceLoader getResourceLoader()
public Class defineClass(ClassNode classNode, String file)
classNode
-
public Class defineClass(ClassNode classNode, String file, String newCodeBase)
classNode
-
public Class parseClass(File file) throws CompilationFailedException, IOException
file
- the file name to parse
CompilationFailedException
IOException
public Class parseClass(String text, String fileName) throws CompilationFailedException
text
- the text of the script/class to parsefileName
- the file name to use as the name of the class
CompilationFailedException
public Class parseClass(String text) throws CompilationFailedException
text
- the text of the script/class to parse
CompilationFailedException
public Class parseClass(InputStream in) throws CompilationFailedException
in
- an InputStream
CompilationFailedException
public Class parseClass(InputStream in, String fileName) throws CompilationFailedException
CompilationFailedException
public Class parseClass(GroovyCodeSource codeSource) throws CompilationFailedException
CompilationFailedException
public Class parseClass(GroovyCodeSource codeSource, boolean shouldCache) throws CompilationFailedException
CompilationFailedException
protected String[] getClassPath()
protected void expandClassPath(List pathList, String base, String classpath, boolean isManifestClasspath)
pathList
- an empty list that will contain the elements of the classpathclasspath
- the classpath specified as a single stringprotected Class defineClass(String name, byte[] bytecode, ProtectionDomain domain)
protected GroovyClassLoader.ClassCollector createCollector(CompilationUnit unit, SourceUnit su)
public Class defineClass(String name, byte[] b)
public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript) throws ClassNotFoundException
ClassNotFoundException
public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve) throws ClassNotFoundException
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
protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException
ClassNotFoundException
ClassLoader.loadClass(java.lang.String, boolean)
public void addClasspath(String path)
public Class[] getLoadedClasses()
Returns all Groovy classes loaded by this class loader.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |