From: Ype K. <yk...@xs...> - 2001-10-09 17:40:33
|
Rohit, >Hi, >I am using a Java application. Now I want to convert >some of the java classes to jython. I want to do it at >the minimum possible level. I mean that I want to do >the least possible changes in my existing code. But I In the best case you only have to make sure your java classes are on the class path when you invoke jython, and then you can use them directly in jython. No conversion needed. >dont know how to build up that abstraction so that my >existing code does not need to know if I am using >A.class or A.py. >Like, for example, say there are classes A, B, C, D, E >and I add instances of A-E to a vector. >v.addElement(new A())etc... Like python, jython is not statically typed. You can use anything at any place. You might get runtime errors, but no compilation error (provided the syntax is correct.) >also I am accessing some method of class A at some >point...say >a=new A() >a.methodCall() >Now if I am implementing classes A-E in Jython, then >how can I neatly maintain the same code. >Can I still do v.addElement(A()) and still call some >method of A.py in my code without doing much changes? Yes. In case you want to access jython classes from java code have a look at: http://www.jython.org/docs/jythonc.html Have fun, Ype |