How to exclude property from Lombok builder?

Vivek Goel picture Vivek Goel · Jun 8, 2015 · Viewed 48k times · Source

I have a class called as "XYZClientWrapper" , which have following structure:

@Builder
XYZClientWrapper{
    String name;
    String domain;
    XYZClient client;
}

What I want no build function generated for property XYZClient client

Does Lombok supports such use case?

Answer

Roel Spilker picture Roel Spilker · Jun 9, 2015

Yes, you can place @Builder on a constructor or static (factory) method, containing just the fields you want.

Disclosure: I am a Lombok developer.