public Object call()

in src/main/java/org/apache/bsf/engines/jython/JythonEngine.java [49:78]


    public Object call(final Object object, final String method, final Object[] args) throws BSFException {
        try {
            PyObject[] pyargs = Py.EmptyObjects;

            if (args != null) {
                pyargs = new PyObject[args.length];
                for (int i = 0; i < pyargs.length; i++) {
                    pyargs[i] = Py.java2py(args[i]);
                }
            }

            if (object != null) {
                final PyObject o = Py.java2py(object);
                return unwrap(o.invoke(method, pyargs));
            }

            PyObject m = interp.get(method);

            if (m == null) {
                m = interp.eval(method);
            }
            if (m != null) {
                return unwrap(m.__call__(pyargs));
            }

            return null;
        } catch (final PyException e) {
            throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e);
        }
    }