Meta-programming with AST Tranformations in Groovy

Have you ever come across a situation where you want to auto inject a common method or field at compile time to set of classes? AST Transformations is the solution.

AST Transformations provide a wonderful way of manipulating code at compile time via modifications in Abstract Syntax Tree. AST Transformations provides Groovy with improved compile-time meta programming capabilities allowing powerful flexibility at the language level, without a runtime performance penalty.

In this session I would be discussing what AST Transformations are and what can be achieved using it. I will be discussing two kinds of transformations :

  1. Global Transformations
  2. Local Transformations

I will discuss predefined annotations in Groovy which uses AST Transformations for necessary code generations e.g. @Delegate, @Immutable, @Singleton, @Newify etc.

Apart from this I will showcase a Case Study for writing custom AST Transformations and it’s benefits.

Speaker:

Gagan Agarwal is a Sr. Consultant at Xebia IT Architects. He has 7 years of experience in Software industry and has worked mainly on Java/J2EE and related technologies. Cont…

Sessions:
IndicThreads Conference On Software Development will be held on 13-14 July 2012 in Delhi India. Click for details on Sessions, Speakers and Location. *Register now to grab the current discounted rates!

Comments are closed.