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: May 13, 2019 | 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.

Zone=Java development, Open source
ArticleTitle=Practically Groovy: Metaprogramming with closures, ExpandoMetaClass, and categories