I\'m trying to achieve following:
class A { def foo() { \"foo\" } } class B { def bar() { \"bar\" } } A.mixin B def a = new A() a.foo() + a.bar()
You can do this since Groovy 1.6
Call mixin on the instance metaClass like so:
class A { def foo() { "foo" } } class B { def bar() { "bar" } } def a = new A() a.metaClass.mixin B a.foo() + a.bar()