I was setting the value of recordId from the child classes using the default constructor and was not using lombok @Builder
initially. Eventually i decided to use the Builder here, but the problem now is lombok Builder overrides my default constructor internally hence the value is never set.
How can I put any hook too make lombok @Builder
use my default constructor?
Parent class:
@Getter
@Setter
public abstract class Record {
private String recordId;
}
Child class:
@Getter
@Setter
@Builder
@ToString
@AllArgsConstructor
public class SRecord extends Record {
private static final String RECORD_ID = "REC001";
private String street;
private String city;
public SRecord() {
setRecordId(RECORD_ID); //value of recordId being set
}
}