annotation

Groovy annotations for compile-time code transformation.

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.” Guillaume Laforge, Groovy Project Lead Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Beginner-Intermediate | ... Read More

Groovy @Builder Annotation – Builder Pattern Made Easy with 10+ Examples

Groovy builder pattern with the @Builder annotation with 10+ examples. DefaultStrategy, SimpleStrategy, ExternalStrategy, InitializerStrategy explained. “The builder pattern separates the construction of a complex object from its representation. Groovy’s @Builder does this without writing a single builder class.” Gang of Four, Design Patterns Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 19 minutes When a class has many fields – some required, some optional – constructors become unwieldy and map-based construction ... Read More

Groovy @Immutable Annotation – Create Immutable Objects with 10+ Examples

Groovy immutable objects with @Immutable annotation to create immutable objects with 10+ examples. Defensive copies, known types, copyWith, and thread-safe value objects. “Immutable objects are always thread-safe. If you can make your objects immutable, you eliminate an entire category of concurrency bugs.” Effective Java, Joshua Bloch Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 18 minutes Creating truly immutable objects in Java requires a checklist: final class, final private fields, no ... Read More