diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-06-13 23:21:00 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-06-13 23:21:00 +0200 |
commit | 19ad4fd57d32afad1a33f20613fbb2e7607cfee0 (patch) | |
tree | 694dedb4dcd2399194f9abb612232a28f8292a45 /website/templates/features/experimental | |
parent | 3256ab6fc71b2b52fe2aedcbf0f59f8f95a0d7e5 (diff) | |
download | lombok-19ad4fd57d32afad1a33f20613fbb2e7607cfee0.tar.gz lombok-19ad4fd57d32afad1a33f20613fbb2e7607cfee0.tar.bz2 lombok-19ad4fd57d32afad1a33f20613fbb2e7607cfee0.zip |
[SuperBuilder] code review, style update, making it JDK1.6 compatible, documentation review, bugfix for setter auto-presuming chaining even when you didn’t configure it to chain.
Diffstat (limited to 'website/templates/features/experimental')
-rw-r--r-- | website/templates/features/experimental/SuperBuilder.html | 11 | ||||
-rw-r--r-- | website/templates/features/experimental/index.html | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html index 4801d373..0249e19a 100644 --- a/website/templates/features/experimental/SuperBuilder.html +++ b/website/templates/features/experimental/SuperBuilder.html @@ -3,7 +3,7 @@ <@f.scaffold title="@SuperBuilder" logline="Bob now knows his ancestors: Builders with fields from superclasses, too. "> <@f.history> <p> - <code>@SuperBuilder</code> was introduced as experimental feature in lombok v1.18.1. + <code>@SuperBuilder</code> was introduced as experimental feature in lombok v1.18.2. </p> </@f.history> @@ -19,10 +19,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> - As lombok has no access to the fields of superclasses when generating the builder code, the methods for setting those superclass fields can only be in the builder of the superclass. - Therefore, a <code>@SuperBuilder</code> must extend the <code>@SuperBuilder</code> of the superclass in order to include those methods. - Furthermore, the generated builder code heavily relies on generics to avoid class casting when using the builder. - <code>@SuperBuilder</code> generates a private constructor on the class that takes a builder instances as a parameter. This constructor sets the fields of the new instance to the values from the builder. + <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. </p><p> <code>@SuperBuilder</code> is not compatible with <code>@Builder</code>. </p><p> @@ -41,8 +38,6 @@ </p> </@f.overview> - <@f.snippets name="Builder" /> - <@f.confKeys> <dt> <code>lombok.superBuilder.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set) @@ -66,6 +61,8 @@ The sorted collections (java.util: <code>SortedSet</code>, <code>NavigableSet</code>, <code>SortedMap</code>, <code>NavigableMap</code> and guava: <code>ImmutableSortedSet</code>, <code>ImmutableSortedMap</code>) require that the type argument of the collection has natural order (implements <code>java.util.Comparable</code>). There is no way to pass an explicit <code>Comparator</code> to use in the builder. </p><p> An <code>ArrayList</code> is used to store added elements as call methods of a <code>@Singular</code> marked field, if the target collection is from the <code>java.util</code> package, <em>even if the collection is a set or map</em>. Because lombok ensures that generated collections are compacted, a new backing instance of a set or map must be constructed anyway, and storing the data as an <code>ArrayList</code> during the build process is more efficient that storing it as a map or set. This behaviour is not externally visible, an implementation detail of the current implementation of the <code>java.util</code> recipes for <code>@Singular</code>. + </p><p> + The generated builder code heavily relies on generics to avoid class casting when using the builder. </p> </@f.smallPrint> </@f.scaffold> diff --git a/website/templates/features/experimental/index.html b/website/templates/features/experimental/index.html index 309303a0..988a7154 100644 --- a/website/templates/features/experimental/index.html +++ b/website/templates/features/experimental/index.html @@ -64,7 +64,7 @@ </@main.feature> <@main.feature title="@SuperBuilder" href="SuperBuilder"> - Bob now knows his ancestors: Builders with fields from superclasses, too. + Bob now knows his ancestors: Builders with fields from superclasses, too. </@main.feature> </div> |