Is it possible to get a reference of the Object that invoked a Closure in the Closure‘s execution context?
For example:
public class Example {
public Example(){
def a = {return this};
def b = [];
b.metaClass.a = a;
println b.a();
}
}
I want this execution to return b instead of an instance of Example.
The object that the closure is invoked on can be referenced as
delegate. Example: