[Java] Class GroovyShell
- groovy.lang.GroovyShell
public class GroovyShell extends GroovyObjectSupport
Represents a groovy shell capable of running arbitrary groovy scripts
Field Summary
Modifiers | Name | Description |
---|---|---|
static String | DEFAULT_CODE_BASE |
Constructor Summary
Constructor and description |
---|
GroovyShell
() |
GroovyShell
(Binding binding) |
GroovyShell
(ClassLoader parent, CompilerConfiguration config) |
GroovyShell
(CompilerConfiguration config) |
GroovyShell
(Binding binding, CompilerConfiguration config) |
GroovyShell
(ClassLoader parent, Binding binding) |
GroovyShell
(ClassLoader parent) |
GroovyShell
(ClassLoader parent, Binding binding, CompilerConfiguration config) |
GroovyShell
(GroovyShell shell) Creates a child shell using a new ClassLoader which uses the parent shell's class loader as its parent |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public GroovyClassLoader |
getClassLoader() | |
public Binding |
getContext() | |
public Object |
getProperty(String property) | |
public static void |
main(String[] args) | |
public void |
resetLoadedClasses() | |
public Object |
run(File scriptFile, List<String> list) A helper method which runs the given script file with the given command line arguments | |
public Object |
run(String scriptText, String fileName, List<String> list) A helper method which runs the given cl script with the given command line arguments | |
public Object |
run(File scriptFile, String[] args) Runs the given script file name with the given command line arguments | |
public void |
setProperty(String property, Object newValue) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class GroovyObjectSupport | getMetaClass, setMetaClass |
Field Detail
public static final String DEFAULT_CODE_BASE
Constructor Detail
public GroovyShell()
public GroovyShell(Binding binding)
public GroovyShell(ClassLoader parent, CompilerConfiguration config)
public GroovyShell(CompilerConfiguration config)
public GroovyShell(Binding binding, CompilerConfiguration config)
public GroovyShell(ClassLoader parent, Binding binding)
public GroovyShell(ClassLoader parent)
public GroovyShell(ClassLoader parent, Binding binding, CompilerConfiguration config)
public GroovyShell(GroovyShell shell)
Creates a child shell using a new ClassLoader which uses the parent shell's class loader as its parent
- Parameters:
-
shell
- is the parent shell used for the variable bindings and the parent class loader
Method Detail
public GroovyClassLoader getClassLoader()
public Binding getContext()
public Object getProperty(String property)
public static void main(String[] args)
public void resetLoadedClasses()
public Object run(File scriptFile, List<String> list)
A helper method which runs the given script file with the given command line arguments
- Parameters:
-
scriptFile
- the file of the script to run -
list
- the command line arguments to pass in
public Object run(String scriptText, String fileName, List<String> list)
A helper method which runs the given cl script with the given command line arguments
- Parameters:
-
scriptText
- is the text content of the script -
fileName
- is the logical file name of the script (which is used to create the class name of the script) -
list
- the command line arguments to pass in
public Object run(File scriptFile, String[] args)
Runs the given script file name with the given command line arguments
- Parameters:
-
scriptFile
- the file name of the script to run -
args
- the command line arguments to pass in
public void setProperty(String property, Object newValue)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/lang/GroovyShell.html