小编use*_*386的帖子

Lombok set default value when an attribute is explicity set to null by builder

I am using the new Builder.Default feature of Lombok version 1.16.16. I would like to configure a class such that an attribute takes a default value if the attribute is not explicitly set via the builder, or if the attribute is set to null by the builder.

Case 1: Attribute is not set

MyClass.Builder().build();

Case 2: Attribute is set to null

MyClass.Builder().myAttribute(null).build();

In both cases I want a default value to be set. The background is that the class will …

lombok

5
推荐指数
1
解决办法
7047
查看次数

标签 统计

lombok ×1