Runtime Metaprogramming With Groovy
summary
Covers Groovy runtime metaprogramming with concrete examples: implements an Expando via a Map using setProperty/getProperty and methodMissing and propertyMissing, shows closures’ delegate first/owner first resolve strategies and how MarkupBuilder and Grails constraints use closure delegates to build DSLs, demonstrates adding methods to java.lang.String with metaClass and per‑instance metaClass, explains ExtensionModule via META-INF/services/org.codehaus.groovy.runtime.ExtensionModule to add methods to classes, shows traits (compile‑time and withTraits runtime proxy), and notes performance tradeoffs and compileStatic limits.
AI-written summary · about
chapters (12)
- 0:00Introduction to metaprogramming
- 1:14Understanding MOP hooks
- 6:12Implementing the expando class
- 13:36Advanced dynamic method handling
- 21:45Closures and delegation
- 32:27DSL creation with delegates
- 39:16Property and method interception
- 42:55Runtime meta-class modification
- 52:19Metaprogramming caveats
- 58:24Groovy module extensions
- 1:09:03Traits in Groovy
- 1:24:32Performance and best practices
related talks
56mMetaprogramming With The Groovy Runtime - Part 1 of 2
31mApache Groovy's Metaprogramming Options and You
52mGroovy MOPping
01h 01mPolyglot Programming in the JVM
51mThe Craft of Metaprogramming on JVM
50mRevealing the magic behind Java annotations
01h 02mFunctional Programming in Java, Groovy, and Kotlin
37mEffective Java with Groovy & Kotlin
