public class ScriptModuleUtils
extends java.lang.Object
Constructor and Description |
---|
ScriptModuleUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
findAssignableClass(ScriptModule module,
java.lang.Class<?> targetClass)
Find the first class in the module that is a subclasses or equal to the target class
|
static java.util.Set<java.lang.Class<?>> |
findAssignableClasses(ScriptModule module,
java.lang.Class<?> targetClass)
Find all of the classes in the module that are subclasses or equal to the target class
|
static java.lang.Class<?> |
findClass(ScriptModule module,
java.lang.String className)
Find a class in the module that matches the given className
|
static void |
toCompiledScriptArchive(ScriptModule module,
java.nio.file.Path jarPath,
java.util.Set<java.lang.String> excludeExtensions)
Convert a ScriptModule to its compiled equivalent ScriptArchive.
|
public static java.util.Set<java.lang.Class<?>> findAssignableClasses(ScriptModule module, java.lang.Class<?> targetClass)
module
- module to searchtargetClass
- target type to search for@Nullable public static java.lang.Class<?> findAssignableClass(ScriptModule module, java.lang.Class<?> targetClass)
module
- module to searchtargetClass
- target type to search for@Nullable public static java.lang.Class<?> findClass(ScriptModule module, java.lang.String className)
module
- the script module to searchclassName
- the class name in dotted form.public static void toCompiledScriptArchive(ScriptModule module, java.nio.file.Path jarPath, java.util.Set<java.lang.String> excludeExtensions) throws java.lang.Exception
A jar script archive is created containing compiled bytecode from a script module, as well as resources and other metadata from the source script archive.
This involves serializing the class bytes of all the loaded classes in the script module, as well as copying over all entries in the original script archive, minus any that have excluded extensions. The module spec of the source script archive is transferred as is to the target bytecode archive.
module
- the input script module containing loaded classesjarPath
- the path to a destination JarScriptArchive.excludeExtensions
- a set of extensions with which
source script archive entries can be excluded.java.lang.Exception