I've run the sample found at http://docs.codehaus.org/display/GROOVY/Using+the+Delegating+Meta+Class where the String class behavior is changed during a script run. However, the change is not replicated when the string.toString() method is called inside of a Java class (triggered from the Groovy Script).
I figure I'm missing a crucial understanding of the Groovy vs Java Classloader... Or is that all real coders always design objects with setDepenedency() methods that allow for easy code injection?
The Groovy String (http://groovy.codehaus.org/groovy-jdk/java/lang/String.html) class is a subclass of java.lang.String. But its toString() method returns a java.lang.String, not a GString. This is one instance where Groovy's transparent dynamic type casting turns out to be a hindrance.
ReplyDelete