It has been a while since project Lombok entered the vibrant world of Java. While it may not be a part of every Java project, it offers many advantages and has probably even influenced some changes in Java itself.
Lombok and Rebel share many similarities. Both of them aim towards making software development less verbose. Both of them use declarative programming constructs. Both of them generate Java code. Finally, both of them reduce the amount of repetitive code you have to write.
Since version 2.4.0, Rebel generates Lombok annotations instead of getters and setters by default.
To use Lombok in the project, we will add Lombok Maven (or Gradle) dependency to the build:
<dependency>
<groupId>
org.projectlombok
</groupId>
<
artifactId
>lombok
<
/artifactId>
<
version
>1.18.16</
version
>
<
scope
>provided</
scope
>
</
dependency
>
To turn off Lombok annotations and use getters and setters, switch Lombok toggle off in Rebel configuration, as shown in the picture below.
To instruct Lombok to create chained setters for you, simply include file named lombok.config
with the following line in the root package of your project:
lombok.chainedSetters=true
.
This gives you the possibility to chain setter invocation for the generated classes. For
instance, you can write:
Person p = new Person().setFirstName("John").setLastName("Doe");
From time to time, we hear people complaining about preserve sections generated by Rebel.
To export your project to a new codebase, without any preserve sections, use the Export option from the Rebel menu. You will be prompted to select a destination directory for your new codebase.
Rebel release 2.4.0 brings some exciting features, Lombok and Project Export being the most significant of them.
Give it a try and let us know if you like it: your feedback truly counts!