I have a class that looks like this:
@EqualsAndHashCode
@RequiredArgsConstructor
public class StatusUpdate {
@Getter
@Setter
private Long id;
@Getter
@Setter
@NonNull
private String text;
@Getter
@Setter
@NonNull
private Date added;
}
And I want to create these two constructors using Lombok:
public StatusUpdate(String text) {
this.text = text;
}
public StatusUpdate(String text, Date added) {
this.text = text;
this.added = added;
}
I tried using all three annotations: @NoArgsConstructor @RequiredArgsConstructor @AllArgsConstructor
But I couldn't do that with these, I only have one constructor that has two parameters, so I need one more constructor with one parameter only. I read this topic: @SomeArgsConstructor and this is what I need but since this does not exists I guess I should create manually one arg constructor that I need and other constructors I'll handle with Lombok, or is there any better / more elegant way to do it using Lombok only?
Thanks!