mercredi 28 avril 2021

How to initialize builder class members with dummy values while calling cls.builder.param().build()

I need to initialize my builder class members with some Dummy values while calling .param()

@Builder
public class MyQuery {
       private String param1;
       private String param1;
       private String param1;
       private String param1;
       ...
       private String param100;
}

When I call the builder class like below, I want them to be initialized with some dummy value(or empty string) and the rest should be null. If I use the LOMBOK builder, it has to be initialized with some value as .param1("some string"). Is there any library which can help me here.

    MyQuery query = MyQuery.builder()
            .param1()
            .param2()
            .param3()
            .build();

Aucun commentaire:

Enregistrer un commentaire