環境は、Groovy 1.6.3 です。
class Test { void print() { println 'Print' } } def t = new Test() t.print() // print Test.metaClass.print = { println 'Class Custom Print' } t.print() // Print new Test().print() // Class Custom Print
環境は、Groovy 1.6.3 です。
class Test { void print() { println 'Print' } } def t = new Test() t.print() // print Test.metaClass.print = { println 'Class Custom Print' } t.print() // Print new Test().print() // Class Custom Print