From bf54986e8a08d246877fae902c58dc41ca2f559b Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 20 Mar 2017 22:54:36 +0100 Subject: Fixing issue #1201: Builder now supports defaults! --- website/features/Builder.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'website/features') diff --git a/website/features/Builder.html b/website/features/Builder.html index 22708c8d..20518226 100644 --- a/website/features/Builder.html +++ b/website/features/Builder.html @@ -20,6 +20,8 @@ @Builder gained @Singular support and was promoted to the main lombok package since lombok v1.16.0.

@Builder with @Singular adds a clear method since lombok v1.16.8. +

+ @Builder.Default functionality was added in lombok v1.16.16.

Overview

@@ -79,7 +81,14 @@

-

@Singular

+

@Builder.Default

+

+ To specify a default value, which will be used if, during the build process this value is never set, initialize the field and add the @Builder.Default annotation:
+ @Builder.Default private final long created = System.currentTimeMillis(); +

+
+
+

@Singular

By annotating one of the parameters (if annotating a method or constructor with @Builder) or fields (if annotating a class with @Builder) with the @Singular annotation, lombok will treat that builder node as a collection, and it generates 2 'adder' methods instead of a 'setter' method. One which adds a single element to the collection, and one -- cgit