Metaprogramming and DSLs

Five lessons on the part of Groovy that a build script uses without naming it: a class that answers a call it never declared, a method added at run time, the transforms the compiler applies, the builders that write XML and JSON, and a DSL of your own with a delegate and @DelegatesTo.

040 methodMissing and propertyMissing a class that answers a call it does not declare, and the error it throws for a typo Open 041 ExpandoMetaClass and categories adding a method to a class at run time, and the category class that scopes it Open 042 AST transformations in use the transforms the language ships, and a local one written with @AnnotationCollector Open 043 Builders MarkupBuilder and JsonBuilder, and the tree a builder builds Open 044 A small DSL a builder of your own with a delegate, and @DelegatesTo for the type checker Open

Lessons