Groovy MOPping
summary
Groovy MOP techniques show how to synthesize methods at runtime, intercept calls with invokeMethod and methodMissing, and inject behavior into existing classes (even java.lang.Long) using ExpandoMetaClass and categories; examples include a transactional AST transformer that wraps methods and a Grape-backed script that pulls jars at runtime. Code uses ExpandoMetaClass, AST transformations, and Spock tests to prove behavior; static type checking (Groovy 2.0 @TypeChecked) is optional. Example tests mostly pass and demonstrate real runtime changes and compiled transforms.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 13:55What is MOP in Groovy
- 29:15Missing methods and synthesis
- 35:17ST transformations in Groovy
- 48:36Groovy MOP in real tasks
- 50:44Conclusion and Q&A
related talks
56mMetaprogramming With The Groovy Runtime - Part 1 of 2
01h 29mRuntime Metaprogramming With Groovy
31mApache Groovy's Metaprogramming Options and You
51mThe Craft of Metaprogramming on JVM
46mGroovy - The Art of Calling Methods
33mMagic AOP
35mWhat makes Groovy a great scripting language
50mRevealing the magic behind Java annotations
