6 Sep 19:42
[groovy-user] Adding method as GString expression to per-instance metaclass
From: Setya <jsetya@...>
Subject: [groovy-user] Adding method as GString expression to per-instance metaclass
Newsgroups: gmane.comp.lang.groovy.user
Date: 2008-09-06 17:44:31 GMT
Subject: [groovy-user] Adding method as GString expression to per-instance metaclass
Newsgroups: gmane.comp.lang.groovy.user
Date: 2008-09-06 17:44:31 GMT
Hi all,
I tried to add dynamic method to per-instance metaclass, the method itself
is in the form of GString expression as follows:
def emc = new ExpandoMetaClass(Expando);
def methodName = 'getTest';
emc."$methodName" = {-> println 'Hello World';};
emc.initialize();
def expando = new Expando();
expando.metaClass = emc;
Than I call the method :
expando.test;
No error was thrown but the closure within 'getTest' is never called
Any ideas ?
Regards,
Setya
--
--
View this message in context: http://www.nabble.com/Adding-method-as-GString-expression-to-per-instance-metaclass-tp19349186p19349186.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
(Continue reading)
RSS Feed