MapConstructor

The @MapConstructor AST transform for map-based construction.

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.” Dierk König, Groovy in Action Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 20 minutes This is Part 2 of our AST transformations series. Part 1 covered the essentials – @ToString, @EqualsAndHashCode, ... Read More