I have the following Groovy closure:
class Widget {
def determineDatastore = { ServiceInstance serviceInstance, String datastoreFolderPath ->
def datastoreFolder = serviceInstance.searchIndex.findByInventoryPath(datastoreFolderPath) as Folder
def datastores = datastoreFolder.childEntity.findAll {!it.name.contains("templates")}
return datastores.max {
Datastore datastore -> datastore.info.freeSpace
}
}
static void main(String[] args) {
Widget w = new Widget()
w.determineDatastore(ServiceInstance.get(), DataStoreFolderPath.get())
}
}
When I run this I am getting:
groovy.lang.MissingMethodException: No signature of method: com.me.myapp.Widget$_closure1_closure3.doCall() is applicable for argument types: (com.vmware.vim25.mo.Folder) values: [Folder:group-s38651 @ https://dev-vcenter.myorg.com/sdk]
Possible solutions: doCall(com.vmware.vim25.mo.Datastore), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:439)
What is going on here?