metaprogramming

Groovy metaprogramming for dynamic method and property injection.

Groovy Advanced AST Transforms – Part 2 with 10+ Examples

Groovy advanced AST transforms beyond @ToString and @Canonical. Part 2 covers @TupleConstructor, @MapConstructor, @Delegate, @Memoized, @AutoClone, @Sortable, @Newify, and combining multiple transforms. “The best boilerplate is the boilerplate you never write. AST transformations are your compiler doing your chores.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Intermediate | Reading Time: 20 minutes This is Part 2 of our AST transformations series. Part 1 covered the essentials – @ToString, @EqualsAndHashCode, @Canonical, @Immutable, and @Builder. Those ... Read More

Groovy Compilation Lifecycle – 10+ Tested Examples

The Groovy compilation lifecycle involves 9 distinct phases. Explore all of them with 12 tested examples covering GroovyClassLoader, CompilationUnit, AST transform hooks, script vs class compilation, and joint Java-Groovy compilation. “Understanding how the compiler thinks is the difference between fighting the language and flowing with it – every advanced Groovy technique traces back to knowing what happens between source code and bytecode.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Advanced | Reading Time: 20 ... Read More

Groovy @Grab Annotation – Practical Recipes with 10+ Examples

Practical Groovy Grab annotation (@Grab) recipes for popular libraries. 12 copy-paste examples: Gson, Apache Commons CSV, OkHttp, JDBC drivers, Jsoup, and more – each with a working script you can run immediately. “The best dependency manager is the one you forget is there – until you need a library at 2 AM and it just downloads itself into your script.” Last Updated: July 2026 | Tested on: Groovy 5.0.6, Java 17+ | Difficulty: Beginner-Intermediate | Reading Time: 16 minutes Grape ... Read More