package com.blogspot.diegopacheco.groovy.interceptor /** * Testes com a metaClass do Groovy * * @author Diego Pacheco * @since 17/02/2009 * @version 1.0 * */ class Stuff { def invokeMe() { "foo" } } Stuff.metaClass.invokeMethod = { String name, args -> def metaMethod = Stuff.metaClass.getMetaMethod(name, args) def result = metaMethod.invoke(delegate,args) println 'interceptado...' return result } println new Stuff().invokeMe()