Search code examples
gwttypessignaturejsni

Java Hashmap and Mutlidimensional array type sig in JSNI?


I've got a method JSNI that calls a Java method that take a Hasmap as input. I've tried

[email protected]::myMethod(Ljava/util/Hashmap;)(myHashMap);
[email protected]::myMethod(Ljava/util/Hashmap<Ljava/lang/String,Ljava/lang/String>;)(myHashMap);

I'm can't seem to define the correct type signature to include the Strings or find if this usage is even allowed.

Since I'm doing this in gwt I though it might be the implementation of hashmap and the alternative approach I've though takes a String[][] array as input

I was hoping for somwthing like

[email protected]::myMethod([[Ljava/lang/String;)(myArray);

However, I hit another issue of finding the correct JNSI sntax for the 2nd dimension of the array

A single dimension array ie. [Ljava/lang/String; is fine but I need the 2nd dimension.

Any help/ideas or links to good jnsi doc appreciated.


Solution

  • Can you post the error that your getting, and also what kind of javascript object your trying to pass as a hashmap. I'm assuming you're getting a compile time error?

    Here is a good start for JSNI documentation:

    GWT JSNI doc

    GWT Blog post on JSNI