AI

Custom AST transformations with Project Lombok

Abstract

Alex Ruiz introduces Project Lombok in this article, discussing some of the programming sugar that makes it unique, including annotation-driven code generation and clean, compact, and readable code. He then draws your attention to one of the more rewarding uses of Lombok: extending it with custom AST (Abstract Syntax Tree) transformations. Extending Lombok will enable you to generate your own project- or domain-specific boilerplate code, but it does require a fair amount of work. Alex concludes with his tips for easing through key stages of the process, along with a freely usable custom extension for JavaBeans.