VMware {code} Community
BlueDevilDan
Contributor
Contributor

Passing JavaScript Array to a Plugin

I have a Java Object in my plugin with an attribute that is a java.util.List. How can I set this value from the Java Script

I tried to use a JavaScript array type but get this error. Cannot convert org.mozilla.javascript.NativeArray@271636 to java.util.List

But I don't know how to make something of the java.util.List type within the scripting context. I guess this is a general question about dealing with plugin object attributes that are collection types.

0 Kudos
1 Reply
BlueDevilDan
Contributor
Contributor

Did some looking into the Rhino libraries that are being used within Orchestrator to support this. Looks like the only thing supported is Java arrays to JavaScript arrays translation. It appears that Java List objects are translated to JavaScript arrays when handed back to the scripting environment, but the reverse translation is not supported out of Rhino (would be a great enhancement to have there).

So it looks like I need to modify the implementation of my plugin to have Java array members that I expose as JavaScript object attributes.

0 Kudos