I needed a Bioclipse manager method that could take an arbitrary number of arguments, (for a general purpose prolog method mapper). Through a useful discussion with jonalv, we figured out that there exists at least one working way of doing this, while there are a number of ways that do not work across both the Rhino/JavaScript though they work in Java alone.
This is the only way I got working:
public ReturnType yourMethod( String[] args ) { ...
var result = yourplugin.yourMethod( [ "arg1", "arg2", "arg3", ... ] );
var args = [ "arg1", "arg2", "arg3", ... ]; var result = yourplugin.yourMethod( args );
What I did also try, which did not work, was for example the following Java method signature:
public ReturnType yourMethod( String argument1, String argument2, String[] args ) { ...
and calling from JavaScript like so:
var result = yourplugin.yourMethod( "arg1", "arg2, [ "arg3", "arg4", "arg5", ... ] );
(Tried a few other combinations too, without success)
Comments
Recorded?
I think it is reasonable to assume this can get recorded properly, as it is easy to see how a String[] should be serialized...
However, with parameters, it's more like key-value pairs, ... I can see this implemented as String[n], where n=0,2,4,6,... (or n=2*m, where m := non-negative integer). As Jonathan mentioned on the mailing list, a Map does not properly get recorded...
Parameters in R-style
I have always wanted map-like input in R-syntax, but this has never been feasible. So to have a set of default params that could be overridden:
Without parsing parameter list, this is not possible. Would be interesting if Groovy (or some other scripting language) has solved this...
I can report that this most
I can report that this most likely can be done using Groovy. At least to my understanding.