def a = 1 def c = {a} assert c() == 1To be able to use a Closure in this way with your own subclass, you need to provide a doCall method with any signature you want to. This ensures that {@link #getMaximumNumberOfParameters()} and {@link #getParameterTypes()} will work too without any additional code. If no doCall method is provided a closure must be used in its long form like
def a = 1 def c = {a} assert c.call() == 1@author James Strachan @author John Wilson @author Jochen Theodorou @author Graeme Rocher @author Paul King @version $Revision: 22366 $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|