Articles for February, 2015

Generating Java Source Files with JavaPoet

Saturday, February 28th, 2015

For the most of us developers, generating Java source files is an occasionally happening task and we’re dealing with it e.g. when writing annotation processors, writing tools or interacting with meta-data files.

JavaPoet is a nice library to simplify such tasks, offering an intuitive fluent-builder API to generate source files in no time.

In the following tutorial I’d like to share a few examples by writing code generators with the help of this library.