在groovy中,如何动态调用类的静态方法?
void callMethod(Class c,String staticmethodname){ //what goes here to call the static method of class c? }
解决方法
瞧
void callMethod(Class c,String staticmethodname){ c."$staticmethodname"() } class test { static someMethod() { println "me" } } callMethod(test,"someMethod")