本文整理汇总了Java中org.python.core.PyObject.__call__方法的典型用法代码示例。如果您正苦于以下问题:Java PyObject.__call__方法的具体用法?Java PyObject.__call__怎么用?Java PyObject.__call__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.python.core.PyObject
的用法示例。
在下文中一共展示了PyObject.__call__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JythonObjectFactory
import org.python.core.PyObject; //导入方法依赖的package包/类
public JythonObjectFactory(Class<T> javaClass, String moduleName, String className, String... bundleNames) {
JythonInterpreterManager.setupSystemState(bundleNames);
PySystemState state = Py.getSystemState();
this.javaClass = javaClass;
PyObject importer = state.getBuiltins().__getitem__(Py.newString("__import__"));
PyObject module = importer.__call__(Py.newString(moduleName));
pyClass = module.__getattr__(className);
}
示例2: pyDecimalFromBigDecimal
import org.python.core.PyObject; //导入方法依赖的package包/类
/**
* Creates a python decimal object from a java BigDecimal object.
* @param bigDecimal The BigDecimal object from which the python decimal
* object should be created from.
* @return A pyObject representing the python decimal.
*/
private PyObject pyDecimalFromBigDecimal(BigDecimal bigDecimal) {
log.debug("pyDecimalFromBigDecimal called with bigDecimal: " + bigDecimal);
PyObject pyDecimal = pyInterpreter.get(PY_DECIMAL_CLASS_NAME);
return pyDecimal.__call__(new PyString(bigDecimal.toString()));
}