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}" = { args ->
        println "done"
    }
}

Thanks,
Douglas