Reputation: 6120
How to prevent null value from being stored as part of List. ignoreNullCollections is not helping here. I want null value to be ignored, no exception should be thrown even if its passed as part of the Singular method call
import lombok.Singular;
@Singular(ignoreNullCollections = true)
List<Foo> foos;
Upvotes: 1
Views: 730
Reputation: 103813
That is so far removed from the kind of boilerplate that lombok is intended to bust, that it is not supported and (as core contributor, I think I can say this): Probably never will.
Normally you can write whichever parts of a builder you want to replace by hand and lombok will just add whatever you left out, but you can't write parts of the @Singular
infrastructure because it is non-intuitive. Thus, your only real option is to make a constructor that strips nulls out of the List<Foo>
parameter you recieve prior to assigning it to your field, and then putting @Builder
on that instead.
Upvotes: 1