ITeye博客

Calling static methods on metaclass

boogie · 2008-06-15 09:37 · Grails · Markdown

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) }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。