aboutsummaryrefslogtreecommitdiff
path: root/website/templates/features/Builder.html
diff options
context:
space:
mode:
Diffstat (limited to 'website/templates/features/Builder.html')
-rw-r--r--website/templates/features/Builder.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/website/templates/features/Builder.html b/website/templates/features/Builder.html
index 082b97ed..0818f9d2 100644
--- a/website/templates/features/Builder.html
+++ b/website/templates/features/Builder.html
@@ -10,6 +10,8 @@
<code>@Builder</code> with <code>@Singular</code> adds a clear method since lombok v1.16.8.
</p><p>
<code>@Builder.Default</code> functionality was added in lombok v1.16.16.
+ </p><p>
+ <code>@Builder(builderMethodName = "")</code> is legal (and will suppress generation of the builder method) starting with lombok v1.18.8.
</p>
</@f.history>
@@ -184,6 +186,13 @@ public class JacksonExample {
</p><p>
Various well known annotations about nullity cause null checks to be inserted and will be copied to parameter of the builder's 'setter' method. See <a href="/features/GetterSetter">Getter/Setter</a> documentation's small print for more information.
</p><p>
+ You can suppress the generation of the <code>builder()</code> method, for example because you <em>just</em> want the <code>toBuilder()</code> functionality, by using:
+ <code>@Builder(builderMethodName = "")</code>. Any warnings about missing <code>@Builder.Default</code> annotations will disappear when you do this, as such warnings
+ are not relevant when only using <code>toBuilder()</code> to make builder instances.
+ </p><p>
+ You can use <code>@Builder</code> for copy constructors: <code>foo.toBuilder().build()</code> makes a shallow clone. Consider suppressing the generating of the
+ <code>builder</code> method if you just want this functionality, by using: <code>@Builder(toBuilder = true, builderMethodName = "")</code>.
+ </p><p>
Due to a peculiar way javac processes static imports, trying to do a non-star static import of the static <code>builder()</code> method won't work. Either use a star static import: `import static TypeThatHasABuilder.*;` or don't statically import the <code>builder</code> method.
</p>
</@f.smallPrint>