Posts Tagged - lombok

Generate a builder with Lombok

Is possible to auto-generate builders for a Java class using @Builder lombok annotation. They’re really simple though and do not provide auto-filling. They just create an API to fill them with test data.

All we need is to put the annotation into a Java class

@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class PersonDto {

  private long id;

  private String name;
  private int age;

  @Singular
  private Set<String> hobbies;

}

Read More