I am studying groovy and I have a question regarding its metaprogramming capabilities. From what I understand, every object in groovy implements the groovy.lang.GroovyObject interface (implicitly added by the groovy compiler). The last interface contains the getMetaClass () method, so I can do the following:
class MyGroovyClass{ } def myGroovyClass = new MyGroovyClass(); println myGroovyClass.metaClass.name
What I don't understand is how objects compiled by the java compiler, like java.lang.String, get the metaClass property. Is this property defined in the actual MetaClass object that is associated with Java classes through MetaClassRegistry?
source share