本文整理匯總了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()));
}