Package de.uni_kiel.rz.fdr.repl.groovy
Class GroovySourceDirectory
java.lang.Object
de.uni_kiel.rz.fdr.repl.groovy.GroovySourceDirectory
Use this class to compile a directory of Groovy sources.
-
Field Summary
FieldsModifier and TypeFieldDescriptionAll the Groovy classes that were successfully compiled by all GroovySourceDirectory instances. -
Constructor Summary
ConstructorsConstructorDescriptionGroovySourceDirectory
(Path root) Compiles the Groovy sources in a directory and its subdirectories, loading it into a private ClassLoader.GroovySourceDirectory
(Path root, ClassLoader classLoader) Compiles the Groovy sources in a directory and its subdirectories.GroovySourceDirectory
(Path root, ClassLoader classLoader, String patcheeClassPath) Compiles the Groovy sources in a directory and its subdirectories.GroovySourceDirectory
(Path root, ClassLoader classLoader, String patcheeClassPath, boolean deferredMetaClasses) Compiles the Groovy sources in a directory and its subdirectories.GroovySourceDirectory
(Path root, ClassLoader classLoader, String patcheeClassPath, boolean deferredMetaClasses, boolean reorderSources) Compiles the Groovy sources in a directory and its subdirectories. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDynamizedMetaClass
(Class<?> theClass) Add aGroovyDynamizedExpando
meta class to a compiled groovy class.Get the list of the Groovy classes that were loaded by this instance.Get the ClassLoader of this directory's Groovy classes.Get a list of all the Groovy source files found in this directory.
-
Field Details
-
groovyClasses
All the Groovy classes that were successfully compiled by all GroovySourceDirectory instances.
-
-
Constructor Details
-
GroovySourceDirectory
public GroovySourceDirectory(Path root) throws IOException, IllegalAccessException, InsufficientAccessRightsException, CompilationException, ClassLoadingException Compiles the Groovy sources in a directory and its subdirectories, loading it into a private ClassLoader.- Parameters:
root
- The directory or alternatively a single file to compile.- Throws:
IOException
- A file or directory can't be accessed.IllegalAccessException
- There was a problem loading a class.CompilationException
- When your sources caused a compilation error.InsufficientAccessRightsException
- When cau-repl does not have the required JVM permissions.ClassLoadingException
- When a class could not be loaded.
-
GroovySourceDirectory
public GroovySourceDirectory(Path root, ClassLoader classLoader) throws IOException, IllegalAccessException, InsufficientAccessRightsException, CompilationException, ClassLoadingException Compiles the Groovy sources in a directory and its subdirectories.- Parameters:
root
- The directory or alternatively a single file to compile.classLoader
- The ClassLoader that the compiled classes will be put in.- Throws:
IOException
- A file or directory can't be accessed.IllegalAccessException
- There was a problem loading a class.CompilationException
- When your sources caused a compilation error.InsufficientAccessRightsException
- When cau-repl does not have the required JVM permissions.ClassLoadingException
- When a class could not be loaded.
-
GroovySourceDirectory
public GroovySourceDirectory(Path root, ClassLoader classLoader, String patcheeClassPath) throws IOException, IllegalAccessException, InsufficientAccessRightsException, CompilationException, ClassLoadingException Compiles the Groovy sources in a directory and its subdirectories.- Parameters:
root
- The directory or alternatively a single file to compile.classLoader
- The ClassLoader that the compiled classes will be put in.patcheeClassPath
- A custom class path that contains the target classes of the@Patches
annotation.- Throws:
IOException
- A file or directory can't be accessed.IllegalAccessException
- There was a problem loading a class.CompilationException
- When your sources caused a compilation error.InsufficientAccessRightsException
- When cau-repl does not have the required JVM permissions.ClassLoadingException
- When a class could not be loaded.
-
GroovySourceDirectory
public GroovySourceDirectory(Path root, ClassLoader classLoader, String patcheeClassPath, boolean deferredMetaClasses) throws IOException, IllegalAccessException, InsufficientAccessRightsException, CompilationException, ClassLoadingException Compiles the Groovy sources in a directory and its subdirectories.- Parameters:
root
- The directory or alternatively a single file to compile.classLoader
- The ClassLoader that the compiled classes will be put in.patcheeClassPath
- A custom class path that contains the target classes of the@Patches
annotation.deferredMetaClasses
- If set, the compiled Groovy classes will not receive ourGroovyDynamizedExpando
metaclass yet. This postpones Java's class initialization, allowing you to trigger it at a later more convenient point in time. You must calladdDynamizedMetaClass(Class)
on your dynamized classes manually before you can use them safely, which is also a method to trigger the initialization.- Throws:
IOException
- A file or directory can't be accessed.IllegalAccessException
- There was a problem loading a class.CompilationException
- When your sources caused a compilation error.InsufficientAccessRightsException
- When cau-repl does not have the required JVM permissions.ClassLoadingException
- When a class could not be loaded.
-
GroovySourceDirectory
public GroovySourceDirectory(Path root, ClassLoader classLoader, String patcheeClassPath, boolean deferredMetaClasses, boolean reorderSources) throws IOException, InvocationTargetException, IllegalAccessException, InsufficientAccessRightsException, CompilationException, ClassLoadingException Compiles the Groovy sources in a directory and its subdirectories.- Parameters:
root
- The directory or alternatively a single file to compile.classLoader
- The ClassLoader that the compiled classes will be put in.patcheeClassPath
- A custom class path that contains the target classes of the@Patches
annotation.deferredMetaClasses
- If set, the compiled Groovy classes will not receive ourGroovyDynamizedExpando
metaclass yet. This postpones Java's class initialization, allowing you to trigger it at a later more convenient point in time. You must calladdDynamizedMetaClass(Class)
on your classes manually before you can use them safely, which is also a method to trigger the initialization.reorderSources
- Can be set tofalse
to disable the source reordering logic. Only use this for debugging. Your sources will probably not compile correctly if disabled.- Throws:
IOException
- A file or directory can't be accessed.InvocationTargetException
- There was a problem loading a class.IllegalAccessException
- There was a problem loading a class.CompilationException
- When your sources caused a compilation error.InsufficientAccessRightsException
- When cau-repl does not have the required JVM permissions.ClassLoadingException
- When a class could not be loaded.
-
-
Method Details
-
getClassLoader
Get the ClassLoader of this directory's Groovy classes.- Returns:
- The ClassLoader of this directory's Groovy classes.
-
getSources
Get a list of all the Groovy source files found in this directory.- Returns:
- A list of all the Groovy source files found in this directory.
-
getClasses
Get the list of the Groovy classes that were loaded by this instance.- Returns:
- the list of the Groovy classes that were loaded by this instance.
-
addDynamizedMetaClass
Add aGroovyDynamizedExpando
meta class to a compiled groovy class. You need to do this manually for dynamized classes if you explicitly deferred this in the settings.- Parameters:
theClass
- The class to augment with the meta class.
-