public class PyModule extends PyObject
| Modifier and Type | Method and Description |
|---|---|
<T> T |
createProxy(Class<T> type)
Create a Java proxy instance of this Python module which contains compatible functions to the ones provided in the
interface given by the
type parameter. |
static PyObject |
extendSysPath(String modulePath,
boolean prepend)
Extends Python's 'sys.path' variable by the given module path.
|
static PyModule |
getBuiltins()
Get the Python interpreter's buildins module and returns its Java representation.
|
static PyModule |
getMain()
Get the Python interpreter's main module and return its Java representation.
|
String |
getName() |
static PyModule |
importModule(String name)
Import a Python module into the Python interpreter and return its Java representation.
|
call, callMethod, createProxy, equals, executeCode, executeCode, finalize, getAttribute, getAttribute, getDoubleValue, getIntValue, getObjectArrayValue, getObjectValue, getPointer, getStringValue, hashCode, setAttribute, setAttribute, toStringpublic String getName()
public static PyModule getMain()
PyLib.execScript("def incByOne(x): return x + 1");
PyModule mainModule = PyModule.getMain();
PyObject eleven = mainModule.call("incByOne", 10);
public static PyModule getBuiltins()
len(), type(), list(), etc. For example:
builtins = PyModule.getBuiltins();
PyObject size = builtins.call("len", pyList);
PyObject.call(String, Object...)public static PyModule importModule(String name)
name - The Python module's name.public static PyObject extendSysPath(String modulePath, boolean prepend)
modulePath - The new module path. Should be an absolute pathname.prepend - If true, the new path will be the new first element of 'sys.path', otherwise it will be the last.public <T> T createProxy(Class<T> type)
type parameter.createProxy in class PyObjectT - The interface name.type - The interface's type.Copyright © 2014–2015 Brockmann Consult GmbH. All rights reserved.