Lombok is…

…this week’s muse. (A weekly featured project/product that will make your short life better.)

Would you give me an uncomfortably long hug if I told you that you never had to write another Java getter/setter again? Project Lombok can help you do this with simple annotations!

class Person {
  @Getter @Setter String firstName;
  @Getter @Setter String lastName;
}

But wait, there’s more. You can eliminate all sorts of boilerplate code: toString(), equals(), hashCode(), etc. The project has great documentation and is easy to get started with.

There is a longer tutorial, Reducing Boilerplate Code with Project Lombok, that also explores the limits and controversy around the project.

share this:Email this to someoneTweet about this on TwitterShare on LinkedInShare on Facebook