logo       

calling methods that take an array or list of interfaces: msg#00105

lang.groovy.user

Subject: 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.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise