Calling static methods on metaclass

1、MyClass with a static method

class MyClass
{
                static processList(list)
                {
                                // does something
                }
}

 

2、Calling static method processList

doProcessList(String className, list)
{
     MetaClass mc =   GroovySystem.metaClassRegistry.getMetaClass(Class.forName(className))
                mc.invokeStaticMethod(‘processList’, list)
}
 

你可能感兴趣的:(grails,groovy)