Package ch.grengine

Class BaseGrengine

java.lang.Object
ch.grengine.BaseGrengine
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
Grengine

public abstract class BaseGrengine extends Object implements Closeable
Abstract base Grengine.

Implements most convenience methods for using Grengine.

Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Engine
    the engine that powers this Grengine.
    protected Loader
    the default loader instance, which is implicitly used when no specific loader is indicated.
    protected SourceFactory
    the source factory used to create instances of Source, often implicitly from script text, file or URL.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    returns a new class loader based on the engine and its default attached loader.
    returns a new class loader based on the engine and the given loader.
    creates an empty binding.
    binding(String key, Object value)
    creates a binding using the given key and value.
    binding(String key1, Object value1, String key2, Object value2)
    creates a binding using the given keys and values.
    binding(String key1, Object value1, String key2, Object value2, String key3, Object value3)
    creates a binding using the given keys and values.
    binding(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4)
    creates a binding using the given keys and values.
    binding(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, Object... moreKeyValuePairs)
    creates a binding using the given keys and values.
    void
    release metadata for all classed ever loaded using this engine.
    create(Loader loader, Source source)
    creates a script (given loader, given source), compiling and loading first if necessary.
    create(Loader loader, File file)
    creates a script (given loader, file-based source), compiling and loading first if necessary.
    create(Loader loader, String text)
    creates a script (given loader, text-based source), compiling and loading first if necessary.
    create(Loader loader, String text, String desiredClassName)
    creates a script (given loader, text-based source with desired class name), compiling and loading first if necessary.
    create(Loader loader, URL url)
    creates a script (given loader, URL-based source), compiling and loading first if necessary.
    create(Source source)
    creates a script (default loader, given source), compiling and loading first if necessary.
    create(File file)
    creates a script (default loader, file-based source), compiling and loading first if necessary.
    create(Class<?> clazz)
    creates an instance of Script from the given class.
    create(String text)
    creates a script (default loader, text-based source), compiling and loading first if necessary.
    create(String text, String desiredClassName)
    creates a script (default loader, text-based source with desired class name), compiling and loading first if necessary.
    create(URL url)
    creates a script (default loader, URL-based source), compiling and loading first if necessary.
    gets the engine.
    gets the default loader instance, which is implicitly used when no specific loader is indicated.
    gets the source factory used to create instances of Source, often implicitly from script text or file or URL.
    load(Loader loader, Source source)
    loads a class (given loader, given source), compiling first if necessary.
    load(Loader loader, File file)
    loads a class (given loader, file-based source), compiling first if necessary.
    load(Loader loader, String text)
    loads a class (given loader, text-based source), compiling first if necessary.
    load(Loader loader, String text, String desiredClassName)
    loads a class (given loader, text-based source with desired class name), compiling first if necessary.
    load(Loader loader, URL url)
    loads a class (given loader, URL-based source), compiling first if necessary.
    load(Source source)
    loads a class (default loader, given source), compiling first if necessary.
    load(File file)
    loads a class (default loader, file-based source), compiling first if necessary.
    load(String text)
    loads a class (default loader, text-based source), compiling first if necessary.
    load(String text, String desiredClassName)
    loads a class (default loader, text-based source with desired class name), compiling first if necessary.
    load(URL url)
    loads a class (default loader, URL-based source), compiling first if necessary.
    abstract Class<?>
    loadClass(Loader loader, Source source, String name)
    loads a class with the given name and from the given source from the given loader.
    abstract Class<?>
    loadClass(Loader loader, String name)
    loads a class by name from the given loader.
    abstract Class<?>
    loadClass(Source source, String name)
    loads a class with the given name and from the given source from the default loader.
    abstract Class<?>
    loads a class by name from the default loader.
    abstract Class<?>
    loadMainClass(Loader loader, Source source)
    loads the main class of the given source from the given loader.
    abstract Class<?>
    loads the main class of the given source from the default loader.
    creates and gets a new attached loader, backed by the same bytecode as all other shared loaders created by this engine and automatically updated if code layers are set.
    creates and gets a new detached loader, backed initially by the same bytecode as all attached loaders created by this engine, but not updated if code layers are set.
    run(Loader loader, Source source)
    creates and runs a script (given loader, given source, empty binding), compiling and loading first if necessary.
    run(Loader loader, Source source, Binding binding)
    creates and runs a script (given loader, given source, given binding), compiling and loading first if necessary.
    run(Loader loader, Source source, Map<String,Object> bindingMap)
    creates and runs a script (given loader, given source, given binding), compiling and loading first if necessary.
    run(Loader loader, File file)
    creates and runs a script (given loader, file-based source, empty binding), compiling and loading first if necessary.
    run(Loader loader, File file, Binding binding)
    creates and runs a script (given loader, file-based source, given binding), compiling and loading first if necessary.
    run(Loader loader, File file, Map<String,Object> bindingMap)
    creates and runs a script (given loader, file-based source, given binding), compiling and loading first if necessary.
    run(Loader loader, String text)
    creates and runs a script (given loader, text-based source, empty binding), compiling and loading first if necessary.
    run(Loader loader, String text, Binding binding)
    creates and runs a script (given loader, text-based source, given binding), compiling and loading first if necessary.
    run(Loader loader, String text, String desiredClassName)
    creates and runs a script (given loader, text-based source with desired class name, empty binding), compiling and loading first if necessary.
    run(Loader loader, String text, String desiredClassName, Binding binding)
    creates and runs a script (given loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
    run(Loader loader, String text, String desiredClassName, Map<String,Object> bindingMap)
    creates and runs a script (given loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
    run(Loader loader, String text, Map<String,Object> bindingMap)
    creates and runs a script (given loader, text-based source, given binding), compiling and loading first if necessary.
    run(Loader loader, URL url)
    creates and runs a script (given loader, URL-based source, empty binding), compiling and loading first if necessary.
    run(Loader loader, URL url, Binding binding)
    creates and runs a script (given loader, URL-based source, given binding), compiling and loading first if necessary.
    run(Loader loader, URL url, Map<String,Object> bindingMap)
    creates and runs a script (given loader, URL-based source, given binding), compiling and loading first if necessary.
    run(Source source)
    creates and runs a script (default loader, given source, empty binding), compiling and loading first if necessary.
    run(Source source, Binding binding)
    creates and runs a script (default loader, given source, given binding), compiling and loading first if necessary.
    run(Source source, Map<String,Object> bindingMap)
    creates and runs a script (default loader, given source, given binding), compiling and loading first if necessary.
    run(Script script)
    runs the given script (empty binding).
    run(Script script, Binding binding)
    runs the given script (given binding).
    run(Script script, Map<String,Object> bindingMap)
    runs the given script (given binding).
    run(File file)
    creates and runs a script (default loader, file-based source, empty binding), compiling and loading first if necessary.
    run(File file, Binding binding)
    creates and runs a script (default loader, file-based source, given binding), compiling and loading first if necessary.
    run(File file, Map<String,Object> bindingMap)
    creates and runs a script (default loader, file-based source, given binding), compiling and loading first if necessary.
    run(String text)
    creates and runs a script (default loader, text-based source, empty binding), compiling and loading first if necessary.
    run(String text, Binding binding)
    creates and runs a script (default loader, text-based source, given binding), compiling and loading first if necessary.
    run(String text, String desiredClassName)
    creates and runs a script (default loader, text-based source with desired class name, empty binding), compiling and loading first if necessary.
    run(String text, String desiredClassName, Binding binding)
    creates and runs a script (default loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
    run(String text, String desiredClassName, Map<String,Object> bindingMap)
    creates and runs a script (default loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
    run(String text, Map<String,Object> bindingMap)
    creates and runs a script (default loader, text-based source, given binding), compiling and loading first if necessary.
    run(URL url)
    creates and runs a script (default loader, URL-based source, empty binding), compiling and loading first if necessary.
    run(URL url, Binding binding)
    creates and runs a script (default loader, URL-based source, new binding), compiling and loading first if necessary.
    run(URL url, Map<String,Object> bindingMap)
    creates and runs a script (default loader, URL-based source, given binding), compiling and loading first if necessary.
    source(File file)
    gets source from script file.
    source(String text)
    gets source from script text.
    source(String text, String desiredClassName)
    gets source from script text and desired class name.
    source(URL url)
    gets source from script URL.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • engine

      protected Engine engine
      the engine that powers this Grengine.
      Since:
      1.0
    • sourceFactory

      protected SourceFactory sourceFactory
      the source factory used to create instances of Source, often implicitly from script text, file or URL.
      Since:
      1.0
    • loader

      protected Loader loader
      the default loader instance, which is implicitly used when no specific loader is indicated.
      Since:
      1.0
  • Constructor Details

    • BaseGrengine

      protected BaseGrengine()
      constructor.
      Since:
      1.0
  • Method Details

    • getEngine

      public Engine getEngine()
      gets the engine.
      Returns:
      engine
      Since:
      1.0
    • getLoader

      public Loader getLoader()
      gets the default loader instance, which is implicitly used when no specific loader is indicated.
      Returns:
      default loader instance
      Since:
      1.0
      See Also:
    • newAttachedLoader

      public Loader newAttachedLoader()
      creates and gets a new attached loader, backed by the same bytecode as all other shared loaders created by this engine and automatically updated if code layers are set.
      Returns:
      new attached loader
      Since:
      1.0
    • newDetachedLoader

      public Loader newDetachedLoader()
      creates and gets a new detached loader, backed initially by the same bytecode as all attached loaders created by this engine, but not updated if code layers are set.

      For example, a web application might create a detached loader for each new HTTP session: A new loader in order to separate static variables of scripts between sessions (security feature); a detached loader in order to keep code layers constant during the lifetime of the session (consistent behavior of Groovy script calls).

      Returns:
      new detached loader
      Since:
      1.0
    • loadMainClass

      public abstract Class<?> loadMainClass(Loader loader, Source source)
      loads the main class of the given source from the given loader.

      Note that if a class with the main class name is available for loading, but was not compiled as part of a set of Source that included the given source, that class will not count for loading.

      Parameters:
      loader - loader
      source - source
      Returns:
      main class
      Throws:
      CompileException - if compilation was necessary to load the class and failed
      LoadException - if loading failed, including if the class was not found
      Since:
      1.0
      See Also:
    • loadMainClass

      public abstract Class<?> loadMainClass(Source source)
      loads the main class of the given source from the default loader.

      Note that if a class with the main class name is available for loading, but was not compiled as part of a set of Source that included the given source, that class will not count for loading.

      Parameters:
      source - source
      Returns:
      main class
      Throws:
      CompileException - if compilation was necessary to load the class and failed
      LoadException - if loading failed, including if the class was not found
      Since:
      1.1.1
      See Also:
    • loadClass

      public abstract Class<?> loadClass(Loader loader, Source source, String name)
      loads a class with the given name and from the given source from the given loader.

      Note that if a class with the given class name is available for loading, but was not compiled as part of a set of Source that included the given source, that class will not count for loading.

      Parameters:
      loader - loader
      source - source
      name - class name
      Returns:
      class
      Throws:
      CompileException - if compilation was necessary to load the class and failed
      LoadException - if loading failed, including if the class was not found
      Since:
      1.0
      See Also:
    • loadClass

      public abstract Class<?> loadClass(Source source, String name)
      loads a class with the given name and from the given source from the default loader.

      Note that if a class with the given class name is available for loading, but was not compiled as part of a set of Source that included the given source, that class will not count for loading.

      Parameters:
      source - source
      name - class name
      Returns:
      class
      Throws:
      CompileException - if compilation was necessary to load the class and failed
      LoadException - if loading failed, including if the class was not found
      Since:
      1.1.1
      See Also:
    • loadClass

      public abstract Class<?> loadClass(Loader loader, String name)
      loads a class by name from the given loader.

      Note that a top code cache is not searched in this case, because each set of source has its own top loader.

      Parameters:
      loader - loader
      name - class name
      Returns:
      class
      Throws:
      LoadException - if loading failed, including if the class was not found
      Since:
      1.0
      See Also:
    • loadClass

      public abstract Class<?> loadClass(String name)
      loads a class by name from the default loader.

      Note that a top code cache is not searched in this case, because each set of source has its own top loader.

      Parameters:
      name - class name
      Returns:
      class
      Throws:
      LoadException - if loading failed, including if the class was not found
      Since:
      1.1.1
      See Also:
    • close

      public void close()
      release metadata for all classed ever loaded using this engine.

      Allows to remove metadata associated by Groovy (or Java) with a class, which is often necessary to get on-the-fly garbage collection.

      Generally call only when really done using this engine and all loaded classes; subsequently trying to use this engine or its classes results generally in undefined behavior.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Since:
      1.1
    • asClassLoader

      public ClassLoader asClassLoader(Loader loader)
      returns a new class loader based on the engine and the given loader.

      Note that the returned class loader typically does not load classes itself; it just wraps the engine and its loader.

      Parameters:
      loader - loader
      Returns:
      class loader
      Throws:
      NullPointerException - if the loader is null
      IllegalArgumentException - if the loader does not match the engine
      Since:
      1.3
    • asClassLoader

      public ClassLoader asClassLoader()
      returns a new class loader based on the engine and its default attached loader.

      Note that the returned class loader typically does not load classes itself; it just wraps the engine and its loader.

      Returns:
      class loader
      Since:
      1.3
    • getSourceFactory

      public SourceFactory getSourceFactory()
      gets the source factory used to create instances of Source, often implicitly from script text or file or URL.
      Returns:
      source factory
      Since:
      1.0
    • source

      public Source source(String text)
      gets source from script text.
      Parameters:
      text - script text
      Returns:
      source
      See Also:
    • source

      public Source source(String text, String desiredClassName)
      gets source from script text and desired class name.
      Parameters:
      text - script text
      desiredClassName - desired class name
      Returns:
      source
      Since:
      1.0
      See Also:
    • source

      public Source source(File file)
      gets source from script file.
      Parameters:
      file - script file
      Returns:
      source
      See Also:
    • source

      public Source source(URL url)
      gets source from script URL.
      Parameters:
      url - script URL
      Returns:
      source
      Since:
      1.0
      See Also:
    • load

      public Class<?> load(String text)
      loads a class (default loader, text-based source), compiling first if necessary.
      Parameters:
      text - script text
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Loader loader, String text)
      loads a class (given loader, text-based source), compiling first if necessary.
      Parameters:
      loader - loader
      text - script text
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(String text, String desiredClassName)
      loads a class (default loader, text-based source with desired class name), compiling first if necessary.
      Parameters:
      text - script text
      desiredClassName - desired class name
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Loader loader, String text, String desiredClassName)
      loads a class (given loader, text-based source with desired class name), compiling first if necessary.
      Parameters:
      loader - loader
      text - script text
      desiredClassName - desired class name
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(File file)
      loads a class (default loader, file-based source), compiling first if necessary.
      Parameters:
      file - script file
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Loader loader, File file)
      loads a class (given loader, file-based source), compiling first if necessary.
      Parameters:
      loader - loader
      file - script file
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(URL url)
      loads a class (default loader, URL-based source), compiling first if necessary.
      Parameters:
      url - script URL
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Loader loader, URL url)
      loads a class (given loader, URL-based source), compiling first if necessary.
      Parameters:
      loader - loader
      url - script URL
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Source source)
      loads a class (default loader, given source), compiling first if necessary.
      Parameters:
      source - source
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • load

      public Class<?> load(Loader loader, Source source)
      loads a class (given loader, given source), compiling first if necessary.
      Parameters:
      loader - loader
      source - source
      Returns:
      loaded class
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      Since:
      1.0
    • create

      public Script create(Class<?> clazz)
      creates an instance of Script from the given class.
      Parameters:
      clazz - class
      Returns:
      new instance
      Throws:
      CreateException - if could not create the instance or the given class is not a script
      Since:
      1.0
    • create

      public Script create(String text)
      creates a script (default loader, text-based source), compiling and loading first if necessary.
      Parameters:
      text - script text
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Loader loader, String text)
      creates a script (given loader, text-based source), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(String text, String desiredClassName)
      creates a script (default loader, text-based source with desired class name), compiling and loading first if necessary.
      Parameters:
      text - script text
      desiredClassName - desired class name
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Loader loader, String text, String desiredClassName)
      creates a script (given loader, text-based source with desired class name), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      desiredClassName - desired class name
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(File file)
      creates a script (default loader, file-based source), compiling and loading first if necessary.
      Parameters:
      file - script file
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Loader loader, File file)
      creates a script (given loader, file-based source), compiling and loading first if necessary.
      Parameters:
      loader - loader
      file - script file
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(URL url)
      creates a script (default loader, URL-based source), compiling and loading first if necessary.
      Parameters:
      url - script URL
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Loader loader, URL url)
      creates a script (given loader, URL-based source), compiling and loading first if necessary.
      Parameters:
      loader - loader
      url - script URL
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Source source)
      creates a script (default loader, given source), compiling and loading first if necessary.
      Parameters:
      source - source
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • create

      public Script create(Loader loader, Source source)
      creates a script (given loader, given source), compiling and loading first if necessary.
      Parameters:
      loader - loader
      source - source
      Returns:
      new instance
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
    • binding

      public Binding binding()
      creates an empty binding.

      Same as new Binding().

      Returns:
      new binding
      Since:
      1.0
    • binding

      public Binding binding(String key, Object value)
      creates a binding using the given key and value.
      Parameters:
      key - key
      value - value
      Returns:
      new binding
      Since:
      1.0
    • binding

      public Binding binding(String key1, Object value1, String key2, Object value2)
      creates a binding using the given keys and values.
      Parameters:
      key1 - key 1
      value1 - value 1
      key2 - key 2
      value2 - value 2
      Returns:
      new binding
      Since:
      1.0
    • binding

      public Binding binding(String key1, Object value1, String key2, Object value2, String key3, Object value3)
      creates a binding using the given keys and values.
      Parameters:
      key1 - key 1
      value1 - value 1
      key2 - key 2
      value2 - value 2
      key3 - key 3
      value3 - value 3
      Returns:
      new binding
      Since:
      1.0
    • binding

      public Binding binding(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4)
      creates a binding using the given keys and values.
      Parameters:
      key1 - key 1
      value1 - value 1
      key2 - key 2
      value2 - value 2
      key3 - key 3
      value3 - value 3
      key4 - key 4
      value4 - value 4
      Returns:
      new binding
      Since:
      1.0
    • binding

      public Binding binding(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, Object... moreKeyValuePairs)
      creates a binding using the given keys and values.
      Parameters:
      key1 - key 1
      value1 - value 1
      key2 - key 2
      value2 - value 2
      key3 - key 3
      value3 - value 3
      key4 - key 4
      value4 - value 4
      key5 - key 5
      value5 - value 5
      moreKeyValuePairs - must be an even number of arguments (key/value) and all keys must be strings
      Returns:
      new binding
      Throws:
      IllegalArgumentException - if the number of arguments is odd or if a key is not a string
      Since:
      1.0
    • run

      public Object run(Script script)
      runs the given script (empty binding).

      Note that the script may throw anything, checked or unchecked.

      Parameters:
      script - script
      Returns:
      what the script returned
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Script script, Map<String,Object> bindingMap)
      runs the given script (given binding).

      Note that the script may throw anything, checked or unchecked.

      Parameters:
      script - script
      bindingMap - binding map
      Returns:
      what the script returned
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Script script, Binding binding)
      runs the given script (given binding).

      Note that the script may throw anything, checked or unchecked.

      Parameters:
      script - script
      binding - binding
      Returns:
      what the script returned
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text)
      creates and runs a script (default loader, text-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text, Map<String,Object> bindingMap)
      creates and runs a script (default loader, text-based source, given binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text, Binding binding)
      creates and runs a script (default loader, text-based source, given binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text)
      creates and runs a script (given loader, text-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text, Map<String,Object> bindingMap)
      creates and runs a script (given loader, text-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text, Binding binding)
      creates and runs a script (given loader, text-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text, String desiredClassName)
      creates and runs a script (default loader, text-based source with desired class name, empty binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      desiredClassName - desired class name
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text, String desiredClassName, Map<String,Object> bindingMap)
      creates and runs a script (default loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      desiredClassName - desired class name
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(String text, String desiredClassName, Binding binding)
      creates and runs a script (default loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
      Parameters:
      text - script text
      desiredClassName - desired class name
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text, String desiredClassName)
      creates and runs a script (given loader, text-based source with desired class name, empty binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      desiredClassName - desired class name
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text, String desiredClassName, Map<String,Object> bindingMap)
      creates and runs a script (given loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      desiredClassName - desired class name
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, String text, String desiredClassName, Binding binding)
      creates and runs a script (given loader, text-based source with desired class name, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      text - script text
      desiredClassName - desired class name
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(File file)
      creates and runs a script (default loader, file-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      file - script file
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(File file, Map<String,Object> bindingMap)
      creates and runs a script (default loader, file-based source, given binding), compiling and loading first if necessary.
      Parameters:
      file - script file
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(File file, Binding binding)
      creates and runs a script (default loader, file-based source, given binding), compiling and loading first if necessary.
      Parameters:
      file - script file
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, File file)
      creates and runs a script (given loader, file-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      file - script file
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, File file, Map<String,Object> bindingMap)
      creates and runs a script (given loader, file-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      file - script file
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, File file, Binding binding)
      creates and runs a script (given loader, file-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      file - script file
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(URL url)
      creates and runs a script (default loader, URL-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      url - script URL
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(URL url, Map<String,Object> bindingMap)
      creates and runs a script (default loader, URL-based source, given binding), compiling and loading first if necessary.
      Parameters:
      url - script URL
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(URL url, Binding binding)
      creates and runs a script (default loader, URL-based source, new binding), compiling and loading first if necessary.
      Parameters:
      url - script URL
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, URL url)
      creates and runs a script (given loader, URL-based source, empty binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      url - script URL
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, URL url, Map<String,Object> bindingMap)
      creates and runs a script (given loader, URL-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      url - script URL
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, URL url, Binding binding)
      creates and runs a script (given loader, URL-based source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      url - script URL
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Source source)
      creates and runs a script (default loader, given source, empty binding), compiling and loading first if necessary.
      Parameters:
      source - source
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Source source, Map<String,Object> bindingMap)
      creates and runs a script (default loader, given source, given binding), compiling and loading first if necessary.
      Parameters:
      source - source
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Source source, Binding binding)
      creates and runs a script (default loader, given source, given binding), compiling and loading first if necessary.
      Parameters:
      source - source
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, Source source)
      creates and runs a script (given loader, given source, empty binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      source - source
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, Source source, Map<String,Object> bindingMap)
      creates and runs a script (given loader, given source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      source - source
      bindingMap - binding map
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw
    • run

      public Object run(Loader loader, Source source, Binding binding)
      creates and runs a script (given loader, given source, given binding), compiling and loading first if necessary.
      Parameters:
      loader - loader
      source - source
      binding - binding
      Returns:
      what the script returned
      Throws:
      CompileException - if compiling failed
      LoadException - if loading failed
      CreateException - if could not create the instance or is not a script
      Since:
      1.0
      Throws (out of Groovy script):
      Throwable - anything (checked or unchecked) that Script.run() may throw