[groovy-user] Call a Java function with String[] argument from Groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[groovy-user] Call a Java function with String[] argument from Groovy

samuel cheung
Hi,

Can someone please tell me how can I call a Java function with String[] as input argument from Groovy?

I try this:

def strs = [
                "x:5 y:139",
                "x:16 y:165" ]

AJavaClass.aJavaFunction(strs);  // signature is aJavaFunction(String[] strs)

but I get this
groovy.lang.MissingMethodException: No signature of method AJavaClass.aJavaFunction() is applicable for argument types: (java.util.ArrayList)

Thank you for any help.


Sam

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [groovy-user] Call a Java function with String[] argument from Groovy

phkim
On Fri, Oct 28, 2005 at 11:45:28PM -0500, samuel cheung wrote:

> Hi,
>
> Can someone please tell me how can I call a Java function with String[] as
> input argument from Groovy?
>
> I try this:
>
> def strs = [
> "x:5 y:139",
> "x:16 y:165" ]
>
> AJavaClass.aJavaFunction(strs); // signature is aJavaFunction(String[] strs)


Try this:

AJavaClass.aJavaFunction(strs as String[]);


Kim

>
> but I get this
> groovy.lang.MissingMethodException: No signature of method
> AJavaClass.aJavaFunction() is applicable for argument types: (
> java.util.ArrayList)
>
> Thank you for any help.
>
>
> Sam
Loading...