PythonUtils¶
-
public class
PythonUtils
¶ Utilities for easier manipulation with Python through Jython.
Author: pipek
Methods¶
asNative¶
-
public static Object
asNative
(PyObject object)¶ Interpret the python object as a native Java one.
Returns: Object of the correct type. It has to be cast to be useful. Numbers converts to numbers (long or double). Dicts converts to TreeMap. Tuples and lists converts to Object[]. Dates converts to Date. NoneType converts to null. In case it does not know a type, it returns its string representation along with ! and type name. (e.g. “!representation of my weird type{WeirdType}”)
getInterpreter¶
-
public static synchronized PythonInterpreter
getInterpreter
()¶ Get a single copy of python interpreter. More of them should not be needed.