Groovy代碼:如何傳遞和返回的參數或值 def method (int a, Closure c) {
Query q = new Query()
c.delegate = q
c()
//label 1: pass a to label 2 and get str from there
}
class Query
{
void key
給定一個參數爲的Java(例如, public class Foo {
public Bar theBar(Bar bar) { /*... */ }
}
當磕碰/ foo的嘲諷,我怎麼告訴它接受任何參數和返回值呢? (Groovy的) def fooStub = Stub(Foo) {
theBar(/*what to pass here*/) >> { x -> x