Practically Groovy, Metaprogramming with closures, ExpandoMetaClass, and categories

Add methods where you want them, when you want them

From the developerWorks archives

Scott Davis

Date archived: April 19, 2017 | First published: June 23, 2009

Enter into the world of metaprogramming, Groovy-style. The ability to add new methods to classes dynamically at run time — even Java™ classes, and even final Java classes — is incredibly powerful. Whether used for production code, unit tests, or anything in between, Groovy's metaprogramming capabilities should pique the curiosity of even the most jaded Java developer.

This content is no longer being updated or maintained. The full article is provided "as is" in a PDF file. Given the rapid evolution of technology, some content, steps, or illustrations may have changed.



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java development, Open source
ArticleID=398957
ArticleTitle=Practically Groovy: Metaprogramming with closures, ExpandoMetaClass, and categories
publish-date=06232009