diff options
-rw-r--r-- | website/templates/features/experimental/SuperBuilder.html | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html index c929e8f5..e9a0958d 100644 --- a/website/templates/features/experimental/SuperBuilder.html +++ b/website/templates/features/experimental/SuperBuilder.html @@ -6,6 +6,8 @@ <code>@SuperBuilder</code> was introduced as experimental feature in lombok v1.18.2. </p><p> <code>@SuperBuilder</code>'s <code>toBuilder</code> feature and limited support for customization was added with lombok v1.18.4. + </p><p> + <code>@SuperBuilder</code> customization possibilities were extended with lombok v1.18.14. </p> </@f.history> @@ -13,7 +15,7 @@ <p> The <code>@SuperBuilder</code> annotation produces complex builder APIs for your classes. In contrast to <a href="/features/Builder"><code>@Builder</code></a>, <code>@SuperBuilder</code> also works with fields from superclasses. - However, it only works for types, and customization possibilities are limited. + However, it only works for types. Most importantly, it requires that <em>all superclasses</em> also have the <code>@SuperBuilder</code> annotation. </p><p> <code>@SuperBuilder</code> lets you automatically produce the code required to have your class be instantiable with code such as:<br /> @@ -21,7 +23,7 @@ </p><p> <code>@SuperBuilder</code> can generate so-called 'singular' methods for collection parameters/fields. For details, see <a href="/features/Builder#singular">the <code>@Singular</code> documentation in <code>@Builder</code></a>. </p><p> - <code>@SuperBuilder</code> generates a private constructor on the class that takes a builder instance as a parameter. This constructor sets the fields of the new instance to the values from the builder. + <code>@SuperBuilder</code> generates a protected constructor on the class that takes a builder instance as a parameter. This constructor sets the fields of the new instance to the values from the builder. </p><p> <code>@SuperBuilder</code> is not compatible with <code>@Builder</code>. </p><p> @@ -32,8 +34,9 @@ </p><p> To ensure type-safety, <code>@SuperBuilder</code> generates two inner builder classes for each annotated class, one abstract and one concrete class named <code><em>Foobar</em>Builder</code> and <code><em>Foobar</em>BuilderImpl</code> (where <em>Foobar</em> is the name of the annotated class). </p><p> - Customizing the code generated by <code>@SuperBuilder</code> is limited to adding new methods or annotations to the builder classes, and providing custom implementations of the 'set', <code>builder()</code>, and <code>build()</code> methods. - You have to make sure that the builder class declaration headers match those that would have been generated by lombok. Due to the heavy generics usage, we strongly advice to copy the builder class definition header from the uncustomized delomboked code. + You can customize most of the code generated by <code>@SuperBuilder</code>, except for internal methods (e.g. <code>self()</code>). + You have to make sure that the builder class declaration headers match those that would have been generated by lombok. + Due to the heavy generics usage, we strongly advice to take the uncustomized <a href="/features/delombok">delomboked code</a> as a reference when customizing <code>@SuperBuilder</code>. </p><p> The configurable aspects of builder are: <ul> |