« Return to Thread: Method created via ExpandoMetaClass is not recognized

Re: Method created via ExpandoMetaClass is not recognized

by Setya :: Rate this Message:

Reply to Author | View in Thread

Hi,

>
> I am also trying to learn Groovy and I tried this thing and for me both
> the
> things worked -
>
> 1) setting this.metaClass = null in the MyGroovyClassImpl constructor in
> MyGroovyClassImpl.groovy
>
> 2) setting MyGroovyClassImpl.metaClass.getNext in a static block so that
> it
> happens only once.
>
> Can you please take out a few moments and explain the effect
> "this.metaClass
> = null" internally has? Does setting it null make the instance use the
> global metaclass that has been affected by setting
> "MyGroovyClassImpl.metaClass.getNext"?

Does your class implement a Java (not Groovy) interface ? and you invoke the script exactly the way I did it from Java (not Groovy) ?

Regards,

Setya

 « Return to Thread: Method created via ExpandoMetaClass is not recognized