Tuesday, November 3, 2009

Converting Groovy Array type to Java Array Type

Following is the code snipped in groovy that demonstrate the conversion Groovy Array type to Java Array Type.
Code for Groovy

def param=[]
param+="paramater 1"
param+="paramater 2"
param+="paramater 3"
param+="paramater 4"
def stringArgForJava = (String[])params


Test.callJavaClass(stringArgForJava) //static method


The sample java class is as follow;

class Test
{
public static void callJavaClass(String[] arg)
{
for(int i=0;i {
System.out.println("params "+i ":" +params[i]);
}

}
}








Read More...

Pages

 ©mytechtoday.com 2006-2010

 ©Mytechtoday

TOP