I need to pass a list of methods to execute inside the class with "closure way", see the code bellow
class A{ def m1(){ println "Method1" } def m2(){ println "Method1" } def commands = { closure-> println "before" closure.call() println "after" } } A a = new A() a.commands{ println "before execute method m1" m1() //A need to execute m1 method of the class A println "after execute method m1" } When I comment the m1() the output is
before before execute method m1 after execute method m1 after otherwise throw the exception MissingMethodException: No signature of method for method m1()
So, it does not recognize the m1() method as method of class A