groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Mendes <douglas.men...@gmail.com>
Subject Override a method without knowing its parameters
Date Thu, 23 Feb 2017 19:12:59 GMT
Hi.

How can I properly override a method given a java.lang.reflect.Method and
its respective MetaClass?

I know that can be achieved by overriding the MetaClass's *invokeMethod *but
I can't do that (even if I could, would like to avoid).

Pseudocode:

*void doAnOverride(MetaClass metaClass, Method method) {*
*    metaClass."${method.name <http://method.name>}" = { args ->*
*        println "done"*
*    }*
*}*

Thanks,
Douglas

Mime
View raw message