No, the prototype is "public void setSites(IWSite[] sites)." It takes
IWSite[]. If you look in the error you will see that the values are actually
WSite. Groovy just can't map them to IWSite[]. I am really beginning to
believe this is a bug and not just a syntax problem. I just find it hard to
believe I am the first person to try this.
Randy
-----Original Message-----
From: Dion Almaer [
mailto:dion@xxxxxxxxxx]
Sent: Thu 10/14/2004 3:54 PM
To: user@xxxxxxxxxxxxxxxxxxx
Cc:
Subject: RE: [groovy-user] calling methods that take an array or list
of interfaces
Shouldn't it be:
criteria.setSiteUuids( wsites.toArray(new WSite[wsites.size()]) );
I.e. new Wsite not the interface.
Dion
-----Original Message-----
From: Randy Thornton [
mailto:randy_thornton@xxxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 3:36 PM
To: user@xxxxxxxxxxxxxxxxxxx
Subject: [groovy-user] calling methods that take an array or list of
interfaces
This is related to the email I sent a few days ago. I can't figure out
how
to pass arrays or list of interface pointers.
Here is the method prototype:
public void setSites(IWSite[] sites) {...}
and the class declaration of WSite and IWSite:
public class WSite implements IWSite {}
This is the line from the script where wsites is an ArrayList of IWSite
objects.
criteria.setSiteUuids( wsites.toArray(new IWSite[wsites.size()]) );
And finally the error that I have become so frustrated with.
No signature of method
com.perfretail.k2v1.wake.reports.WReportsCriteria.setSiteUuids() is
applicable for argument types: ([Lcom.perfretail.k2v1.wake.api.IWSite;)
values: [[com.perfretail.k2v1.wake.core.WSite@8f83a9[name=Store
100,uuid=afefe88416e94d9449186e9],
com.perfretail.k2v1.wake.core.WSite@cf590[name=Store
200,uuid=afefe88416e94fb44918796]]]
As you can see it is an array of WSite, but it can't resolve it to
IWSite.
The same behavior exists for methods that take in a List as an argument
as
my previous email.
Thread at a glance:
Previous Message by Date:
click to view message preview
RE: calling methods that take an array or list of interfaces
Shouldn't it be:
criteria.setSiteUuids( wsites.toArray(new WSite[wsites.size()]) );
I.e. new Wsite not the interface.
Dion
-----Original Message-----
From: Randy Thornton
[mailto:randy_thornton-j507d6adJKUVOD6bQOMgHhL4W9x8LtSr@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 3:36 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: [groovy-user] calling methods that take an array or list of
interfaces
This is related to the email I sent a few days ago. I can't figure out how
to pass arrays or list of interface pointers.
Here is the method prototype:
public void setSites(IWSite[] sites) {...}
and the class declaration of WSite and IWSite:
public class WSite implements IWSite {}
This is the line from the script where wsites is an ArrayList of IWSite
objects.
criteria.setSiteUuids( wsites.toArray(new IWSite[wsites.size()]) );
And finally the error that I have become so frustrated with.
No signature of method
com.perfretail.k2v1.wake.reports.WReportsCriteria.setSiteUuids() is
applicable for argument types: ([Lcom.perfretail.k2v1.wake.api.IWSite;)
values: [[com.perfretail.k2v1.wake.core.WSite@8f83a9[name=Store
100,uuid=afefe88416e94d9449186e9],
com.perfretail.k2v1.wake.core.WSite@cf590[name=Store
200,uuid=afefe88416e94fb44918796]]]
As you can see it is an array of WSite, but it can't resolve it to IWSite.
The same behavior exists for methods that take in a List as an argument as
my previous email.
Next Message by Date:
click to view message preview
RE: calling methods that take an array or list of interfaces
Maybe I am on the wrong track here, but in toArray() you need to pass in an
array.
How can you create a new array of interfaces? new WSite[...] creates the
real array (which implements IWSite, and has instanceof).
Dion
-----Original Message-----
From: Randy Thornton
[mailto:randy_thornton-j507d6adJKUVOD6bQOMgHhL4W9x8LtSr@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 5:05 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: RE: [groovy-user] calling methods that take an array or list of
interfaces
No, the prototype is "public void setSites(IWSite[] sites)." It takes
IWSite[]. If you look in the error you will see that the values are
actually WSite. Groovy just can't map them to IWSite[]. I am really
beginning to believe this is a bug and not just a syntax problem. I just
find it hard to believe I am the first person to try this.
Randy
-----Original Message-----
From: Dion Almaer [mailto:dion-4eS6uFwS6GLQT0dZR+AlfA@xxxxxxxxxxxxxxxx]
Sent: Thu 10/14/2004 3:54 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Cc:
Subject: RE: [groovy-user] calling methods that take an array or
list of interfaces
Shouldn't it be:
criteria.setSiteUuids( wsites.toArray(new WSite[wsites.size()]) );
I.e. new Wsite not the interface.
Dion
-----Original Message-----
From: Randy Thornton
[mailto:randy_thornton-j507d6adJKUVOD6bQOMgHhL4W9x8LtSr@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 3:36 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: [groovy-user] calling methods that take an array or list of
interfaces
This is related to the email I sent a few days ago. I can't figure
out how
to pass arrays or list of interface pointers.
Here is the method prototype:
public void setSites(IWSite[] sites) {...}
and the class declaration of WSite and IWSite:
public class WSite implements IWSite {}
This is the line from the script where wsites is an ArrayList of
IWSite
objects.
criteria.setSiteUuids( wsites.toArray(new IWSite[wsites.size()]) );
And finally the error that I have become so frustrated with.
No signature of method
com.perfretail.k2v1.wake.reports.WReportsCriteria.setSiteUuids() is
applicable for argument types:
([Lcom.perfretail.k2v1.wake.api.IWSite;)
values: [[com.perfretail.k2v1.wake.core.WSite@8f83a9[name=Store
100,uuid=afefe88416e94d9449186e9],
com.perfretail.k2v1.wake.core.WSite@cf590[name=Store
200,uuid=afefe88416e94fb44918796]]]
As you can see it is an array of WSite, but it can't resolve it to
IWSite.
The same behavior exists for methods that take in a List as an
argument as
my previous email.
Previous Message by Thread:
click to view message preview
Re: calling methods that take an array or list of interfaces
Here is an example of a method accepting an interface, and the groovy
script which uses the method successfully (even with beta 7! ;-).
Here is the groovy script (swap Vector for List,ArrayList and also works
grand):
-----------------
java.util.Vector bars = new java.util.Vector();
for(i in 1..10) {
bars.add(new Bar());
}
foo = new Foo();
foo.doSomething(bars.toArray(new IBar[0]));
-----------------
Here are the corresponding java classes:
-----------------
public interface IBar{
public void doit();
}
-----------------
public class Bar implements IBar, java.io.Serializable {
public void doit() {
System.out.println("this is Bar.doit()");
}
}
-----------------
public class Foo{
public void doSomething(IBar[] bars){
for(int i=0;i<bars.length;i++){
bars[i].doit();
}
}
}
-----------------
Best regards,
Robert.
> This is related to the email I sent a few days ago. I can't figure out
> how to pass arrays or list of interface pointers.
>
> Here is the method prototype:
> public void setSites(IWSite[] sites) {...}
>
> and the class declaration of WSite and IWSite:
>
> public class WSite implements IWSite {}
>
> This is the line from the script where wsites is an ArrayList of IWSite
> objects.
>
> criteria.setSiteUuids( wsites.toArray(new IWSite[wsites.size()]) );
>
> And finally the error that I have become so frustrated with.
> No signature of method
> com.perfretail.k2v1.wake.reports.WReportsCriteria.setSiteUuids() is
> applicable for argument types: ([Lcom.perfretail.k2v1.wake.api.IWSite;)
> values: [[com.perfretail.k2v1.wake.core.WSite@8f83a9[name=Store
> 100,uuid=afefe88416e94d9449186e9],
> com.perfretail.k2v1.wake.core.WSite@cf590[name=Store
> 200,uuid=afefe88416e94fb44918796]]]
> As you can see it is an array of WSite, but it can't resolve it to IWSite.
> The same behavior exists for methods that take in a List as an argument
> as my previous email.
>
>
>
>
>
--
Robert Fuller
rfuller-uSSxwurkIxcAvxtiuMwx3w@xxxxxxxxxxxxxxxx | +353.86.0507760 |
http://www.aplpi.com
Applepie Solutions Ltd., Galway, Ireland.
Next Message by Thread:
click to view message preview
RE: calling methods that take an array or list of interfaces
Maybe I am on the wrong track here, but in toArray() you need to pass in an
array.
How can you create a new array of interfaces? new WSite[...] creates the
real array (which implements IWSite, and has instanceof).
Dion
-----Original Message-----
From: Randy Thornton
[mailto:randy_thornton-j507d6adJKUVOD6bQOMgHhL4W9x8LtSr@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 5:05 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: RE: [groovy-user] calling methods that take an array or list of
interfaces
No, the prototype is "public void setSites(IWSite[] sites)." It takes
IWSite[]. If you look in the error you will see that the values are
actually WSite. Groovy just can't map them to IWSite[]. I am really
beginning to believe this is a bug and not just a syntax problem. I just
find it hard to believe I am the first person to try this.
Randy
-----Original Message-----
From: Dion Almaer [mailto:dion-4eS6uFwS6GLQT0dZR+AlfA@xxxxxxxxxxxxxxxx]
Sent: Thu 10/14/2004 3:54 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Cc:
Subject: RE: [groovy-user] calling methods that take an array or
list of interfaces
Shouldn't it be:
criteria.setSiteUuids( wsites.toArray(new WSite[wsites.size()]) );
I.e. new Wsite not the interface.
Dion
-----Original Message-----
From: Randy Thornton
[mailto:randy_thornton-j507d6adJKUVOD6bQOMgHhL4W9x8LtSr@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 14, 2004 3:36 PM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: [groovy-user] calling methods that take an array or list of
interfaces
This is related to the email I sent a few days ago. I can't figure
out how
to pass arrays or list of interface pointers.
Here is the method prototype:
public void setSites(IWSite[] sites) {...}
and the class declaration of WSite and IWSite:
public class WSite implements IWSite {}
This is the line from the script where wsites is an ArrayList of
IWSite
objects.
criteria.setSiteUuids( wsites.toArray(new IWSite[wsites.size()]) );
And finally the error that I have become so frustrated with.
No signature of method
com.perfretail.k2v1.wake.reports.WReportsCriteria.setSiteUuids() is
applicable for argument types:
([Lcom.perfretail.k2v1.wake.api.IWSite;)
values: [[com.perfretail.k2v1.wake.core.WSite@8f83a9[name=Store
100,uuid=afefe88416e94d9449186e9],
com.perfretail.k2v1.wake.core.WSite@cf590[name=Store
200,uuid=afefe88416e94fb44918796]]]
As you can see it is an array of WSite, but it can't resolve it to
IWSite.
The same behavior exists for methods that take in a List as an
argument as
my previous email.