"$action"(param1, param2) isn't working but method(param1, param2) does
So I am trying to avoid having a switch or bunch of if statements where I have a json request coming in and it has a property called action. That action is also the name of my closure method. But when I try using
"$jsonData.action"(params) I get an error
groovy.lang.MissingMethodException: No signature of method: GroovyScript.gameTableList() is applicable for argument types: (java.util.HashMap) values: [[action:gameTableList]]
but if I call the method with
gameTableList(params) it works.
Is there another way to dynamically call methods?