Why is Lombok @Builder not compatible with this constructor?

前端 未结 3 1190
挽巷
挽巷 2021-01-04 00:16

I have this simple code:

@Data
@Builder
public class RegistrationInfo {

    private String mail;
    private String password;

    public RegistrationInfo(R         


        
3条回答
  •  萌比男神i
    2021-01-04 00:33

    Presumably, @Builder generates an all-args constructor iff there are no other constructors defined.

    @Data
    @Builder
    @AllArgsConstructor(access = AccessLevel.PRIVATE)
    class RegistrationInfo {
    
        private String mail;
        private String password;
    
        private RegistrationInfo(RegistrationInfo registrationInfo) {
            this(registrationInfo.mail, registrationInfo.password);
        }
    }
    

提交回复
热议问题