From: D-Man <ds...@ri...> - 2001-06-05 17:39:08
|
On Tue, Jun 05, 2001 at 03:29:08PM +0200, Waclawczyk Janusch wrote: | Hello, | | I try to call in my jython script a java method, which expects | Hashtable as argument. But it fails: | | Jython 2.0 on java1.1.8 (JIT: ) | >>> import Test1 # it is my java test class | >>> Test1.testPyToJavaHash({"key":"value"}) | TypeError: testPyToJavaHash(): 1st arg can't be coerced to java.util.Hashtable | | Why is it not possible? (due to primitive types ? ) | It would be a nice feature ! (e.g. int -> Integer, ...) There is a lot of automatic type coercion done by Jython. See the section "Calling Java Methods and Functions" at http://jython.sourceforge.net/docs/usejava.html. I don't think jython does any Java<->Java coercion but it does Python<->Java coercion. I haven't tried passing Python dictionaries or lists to a Java method that wants an instance of a Java class yet. -D |