public class JepConfig
extends java.lang.Object
A configuration object for constructing a Jep instance, corresponding to the configuration of the particular Python sub-interpreter. This class is intended to make constructing Jep instances easier while maintaining compatible APIs between releases.
Constructor and Description |
---|
JepConfig() |
Modifier and Type | Method and Description |
---|---|
JepConfig |
addIncludePaths(java.lang.String... includePaths)
Adds a path of directories separated by File.pathSeparator that will be
appended to the sub-intepreter's
sys.path |
JepConfig |
addSharedModules(java.lang.String... sharedModule)
Adds module names to the set of shared modules
|
SubInterpreter |
createSubInterpreter()
Creates a new Jep instance and its associated sub-interpreter with this
JepConfig.
|
JepConfig |
redirectStdErr(java.io.OutputStream outputStream)
Redirects the Python interpreter's sys.stderr to the provided
OutputStream.
|
JepConfig |
redirectStdout(java.io.OutputStream outputStream)
Redirects the Python interpreter's sys.stdout to the provided
OutputStream.
|
JepConfig |
setClassEnquirer(ClassEnquirer classEnquirer)
Sets a ClassEnquirer to determine which imports are Python vs Java, or
null for the default
ClassList |
JepConfig |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader to use when importing Java classes from Python
|
JepConfig |
setIncludePath(java.lang.String includePath)
Sets a path of directories separated by File.pathSeparator that will be
appended to the sub-intepreter's
sys.path |
JepConfig |
setSharedModules(java.util.Set<java.lang.String> sharedModules)
Sets the names of modules which should be shared with other Jep
sub-interpreters.
|
public JepConfig setIncludePath(java.lang.String includePath)
sys.path
includePath
- directory or directories to include on sys.pathpublic JepConfig addIncludePaths(java.lang.String... includePaths)
sys.path
includePaths
- directories to include on sys.pathpublic JepConfig setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- the initial ClassLoader for the Jep instancepublic JepConfig setClassEnquirer(ClassEnquirer classEnquirer)
ClassList
classEnquirer
- the ClassEnquirer for the Jep instancepublic JepConfig redirectStdout(java.io.OutputStream outputStream)
outputStream
- the Java OutputStream to redirect Python stdout topublic JepConfig redirectStdErr(java.io.OutputStream outputStream)
outputStream
- the Java OutputStream to redirect Python stderr topublic JepConfig setSharedModules(java.util.Set<java.lang.String> sharedModules)
sharedModules
- a set of module names that should be sharedpublic JepConfig addSharedModules(java.lang.String... sharedModule)
sharedModule
- a set of module names that should be sharedsetSharedModules(Set)
public SubInterpreter createSubInterpreter() throws JepException
JepException
- if an error occurs