I want to be sure I am not going to cause a performance issue with this. We are writing a simple Money DSL and I was advised to turn on:
ExpandoMetaClass.enableGlobally()
However, I cannot determine yet exactly what this means. Does it only enable metaclass overrides on the inheritance tree for the root object, or does it apply it to every object type in memory?
Are there risks to applying Expando globally to a production instance?
Grails does this already, so whatever cost is involved is already incurred :)
This setting changes the default MetaClass implementation from MetaClassImpl to ExpandoMetaClass. ExpandoMetaClass was written by Graeme for Grails to make it easier to dynamically add methods to the metaclass, e.g.
String.metaClass.bark = { -> println "WOOF!" }
and it was added to Groovy core years ago.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With