Dynamic method invocation
anishaapte at gmail.com
Tue Jun 23 18:54:02 CEST 2009
I am new to jythong and was wondering if/how I can do the following -
a) register a java object with a given name with jython interpreter
using set method
b) call methods on the java object - but the methods may not exist on
the object, so I would like to call from jython a generic method that
I have defined on the object as opposed to using java reflection.
Thus the java class is more like a proxy for invocation.
As an example, I register an instance of java class Bar with name
foo. I want to be able to call from jython -
I don't want to define all the methods that I can call from jython on
class foo but have a generic method that the above jython code will
invoke. I want to use a model where the methods that can be called on
foo are discovered dynamically once they are invoked on java class.
Clearly Java won't let me do this during method invocation so I am
wondering if I can register some sort of proxy object with jython that
will let me then delegate right call down to the java object.
Thanks a bunch
More information about the Python-list