Hi guys.
I have a problem when using Jython, but I can't seem to find a solution in the documentation.
Basically what I have is an object that has been instantiated in Java, and I want to instantiate another Java object (in the python script) and have the pre-instatiated java object added to the object I have instantiated in the jython interpreter.
For example:
public class A {
private B bInstance;
public void setB(B bval) {
bInstance = b;
}
}
public class B {
private String name;
public String getName() {
return name;
}
public void setName(String n) {
this.name = n;
}
}
python script (there is an instance of B bound as "b_inst"):
import com.package.A
a_inst = com.package.A()
a_inst.setB(b_inst)
When I try to run the above code I get the following exception: TypeError: setB(): expected 2 args; got 1
I am pretty sure this is because the setB() method is attempting to call a method on a Python object, not on the actual java object. Basically I expect the call to setB() on the instance of A I have just created in the jython script to be a java object, not a python object.
Sorry if this is obvious, I've read the tutorials as well as the Jython sections of "Java in a Nutshell" and "Core Python Programming", but the examples are really really simple, they have no examples of how to do this two-way binding.