I have found DTO/Model objects has getters and setters in camunda modules. So when we have lot of fields, getters and setters will reduce the readability of the code. When we need to add new field to any models just adding the field will create the getters/setters on the fly using lombok dependency.
REDUCE BOILERPLATE CODE WITH PROJECT LOMBOK
Equivalent code in the FetchAndLockRequest.java can be created as below:
@Getter
@Setter
@NoArgsConstructor
public class FetchAndLockRequest {
protected Date requestTime = ClockUtil.getCurrentTime();
protected FetchExternalTasksExtendedDto dto;
protected AsyncResponse asyncResponse;
protected String processEngineName;
protected Authentication authentication;
}
Below Code block can be achieved same with just by adding the annotation @ToString
@Override
public String toString() {
return "FetchAndLockRequest [requestTime=" + requestTime + ", dto=" + dto + ", asyncResponse=" + asyncResponse + ", processEngineName=" + processEngineName
+ ", authentication=" + authentication + "]";
}
All the docs described here, from installation to implementation and delomboking.
Lombok will be added as:
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.9.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>projectlombok.org</id>
<url>http://projectlombok.org/mavenrepo</url>
</repository>
</repositories>
Project Lombok provides the delombok
utility for replacing the Lombok annotations with equivalent source code. This can be done for an entire source directory via the command line.
java -jar lombok.jar delombok src -d src-delomboked