Examples of PyJavaInstance


Examples of org.python.core.PyJavaInstance

      
    protected PythonInterpreter passArgument(Object arg, String argName,
        PythonInterpreter interp) {
      if (! (arg instanceof File)) {
      interp.set(argName,
          new PyJavaInstance(arg));
    } else {
      try {
      File fileArg = (File) arg;
      InputStream fileStream = fileArg.toURL().openStream();
      interp.set(argName,
View Full Code Here

Examples of org.python.core.PyJavaInstance

                        o.getClass().toString(), o.toString()));
                debugVar = dumpJavaObject(o, debugVar);
            }
            return debugVar;
        } else if (value instanceof PyJavaInstance) {
            PyJavaInstance pythonValue = (PyJavaInstance) value;
            Object javaObject = pythonValue.__tojava__(Object.class);
            if (javaObject instanceof ArrayList) {
                ArrayList<?> javaObjectArray = (ArrayList<?>) javaObject;
                Iterator<?> arrayIterator = javaObjectArray.iterator();
                while (arrayIterator.hasNext()) {
                    Object arrayListObject = arrayIterator.next();
View Full Code Here

Examples of org.python.core.PyJavaInstance

        // set up access to this actor
        // first create an attribute "actor" on the object
        // the PyObject class does not allow adding a new attribute to the
        // object
        object.__setattr__("actor", new PyJavaInstance(this));

        // give the object access to attributes and ports of this actor
        Iterator attributes = attributeList().iterator();

        while (attributes.hasNext()) {
            Attribute attribute = (Attribute) attributes.next();
            String mangledName = _mangleName(attribute.getName());

            if (_debugging) {
                _debug("set up reference to attribute \"" + attribute.getName()
                        + "\" as \"" + mangledName + "\"");
            }

            object.__setattr__(new PyString(mangledName), new PyJavaInstance(
                    attribute));
        }

        Iterator ports = portList().iterator();

        while (ports.hasNext()) {
            Port port = (Port) ports.next();
            String mangledName = _mangleName(port.getName());

            if (_debugging) {
                _debug("set up reference to port \"" + port.getName()
                        + "\" as \"" + mangledName + "\"");
            }

            object.__setattr__(new PyString(mangledName), new PyJavaInstance(
                    port));
        }

        // populate the method map
        for (int i = 0; i < _METHOD_NAMES.length; ++i) {
View Full Code Here

Examples of org.python.core.PyJavaInstance

                } else {
                    PyObject[] convertedArgs = new PyObject[args.length];

                    for (int i = 0; i < args.length; ++i) {
                        if (!(args[i] instanceof PyObject)) {
                            convertedArgs[i] = new PyJavaInstance(args[i]);
                        } else {
                            convertedArgs[i] = (PyObject) args[i];
                        }
                    }
View Full Code Here

Examples of org.python.core.PyJavaInstance

        if (arguments == null) {
          _this = ((PyFunction) getInstance).__call__();
        } else {
          PyObject[] args = new PyObject[arguments.length];
          for (int i=0; i<arguments.length; i++) {
            args[i] = new PyJavaInstance(arguments[i]);
          }
          _this = ((PyFunction) getInstance).__call__(args);
        }
        return _this.__tojava__(scriptInterfaces[0]);
      } catch (Exception ex) {
View Full Code Here

Examples of org.python.core.PyJavaInstance

    public PyObject adapt(Object o) {
        PyObject result = super.adapt(o);
        if (result != null) {
            return result;
        }
        return new PyJavaInstance(o);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.