From: David G. <gr...@gm...> - 2008-08-11 06:40:06
|
I have a java abstract class "uiscript". It has an abstract method "display" At runtime I create an interpreter and read some Jython text from somewhere (myJythonClass.py) This text contains a class definition for a class that overrides "uiscript" and which implements the display() method. I execute this Jython text then I get a class object, and execute that to instantiate an object of this class. Using __tojava__ I get an object representing an instance of the class. In Java I can now treat this object as an instance of uiscript and execute the display() method. Here's the question. What is this Java class (of which this object is an instance) exactly ? Is it a java wrapper round a class whose method code is in Jython ? Or have I now got an instance of a fully compiled java class, compiled on the fly as part of the __tojava__ process ? Put another way, is the Jython code in the display() method (and any other Jython methods it calls) going to be executed by the interpreter or as Java byte code ? Could the interpreter go out of scope while I still have a valid reference to this new object in Java ? I suspect that when I fully understand what is happening here I will realise the question is the wrong question but I only learn by asking... One other question. If I create many many class definitions in my interpreter in a given session - are they just in memory ? Or is there any disk usage related to this - how do I remove a definition of a class I don't intend to use any more to free up some resources ? TIA David Griffin |