Skip to content

Commit

Permalink
[fixes #3547] [docs] Add a note Builder.Default limitation with records
Browse files Browse the repository at this point in the history
  • Loading branch information
kraiss committed Mar 29, 2024
1 parent 9dc7e7f commit d4072de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions website/templates/features/Builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ <h3 id="builderdefault"><a name="builderdefault">@Builder.Default</a></h3>
<code>@Builder.Default private final long created = System.currentTimeMillis();</code><br/>
Calling Lombok-generated constructors such as <code>@NoArgsConstructor</code> will also make use of the defaults specified using <code>@Builder.Default</code> however explicit constructors will no longer use the default values and will need to be set manually or call a Lombok-generated constructor such as <code>this();</code> to set the defaults.
</p>
<p>
<code>@Builder.Default</code> is not supported with <code>records</code>. Instead, you can customize the builder class to set the default value
</p>
<ol class="snippet example">
<li>public static class PersonBuilder {</li>
<li class="continued">private String city = "San Francisco";</li>
<li>}</li>
</ol>
</@f.featureSection>

<@f.featureSection>
Expand Down

0 comments on commit d4072de

Please sign in to comment.