diff options
author | Jan Rieke <rieke@subshell.com> | 2019-01-16 14:18:17 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2019-01-21 21:55:56 +0100 |
commit | 7a84e760c2008cb38ce26813cd7651cebae43f6f (patch) | |
tree | 255a9843c0ca7e6153f69ca23857ca59f6e0b18c /website | |
parent | e59beb76481c526ca0a62cc7fcd2782c628c5dfb (diff) | |
download | lombok-7a84e760c2008cb38ce26813cd7651cebae43f6f.tar.gz lombok-7a84e760c2008cb38ce26813cd7651cebae43f6f.tar.bz2 lombok-7a84e760c2008cb38ce26813cd7651cebae43f6f.zip |
toBuilder required for all superclasses; removed Singular smallprint
Diffstat (limited to 'website')
-rw-r--r-- | website/templates/features/experimental/SuperBuilder.html | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html index 26f0a949..56893df7 100644 --- a/website/templates/features/experimental/SuperBuilder.html +++ b/website/templates/features/experimental/SuperBuilder.html @@ -25,7 +25,10 @@ </p><p> <code>@SuperBuilder</code> is not compatible with <code>@Builder</code>. </p><p> - You can use <code>@SuperBuilder(toBuilder = true)</code> to also generate an instance method in your class called <code>toBuilder()</code>; it creates a new builder that starts out with all the values of this instance. You can put the <code>@Builder.ObtainVia</code> annotation on the fields to indicate alternative means by which the value for that field/parameter is obtained from this instance. For example, you can specify a method to be invoked: <code>@Builder.ObtainVia(method = "calculateFoo")</code>. + You can use <code>@SuperBuilder(toBuilder = true)</code> to also generate an instance method in your class called <code>toBuilder()</code>; it creates a new builder that starts out with all the values of this instance. + Using <code>toBuilder</code> requires that all superclasses must also have <code>toBuilder = true</code>. + You can put the <code>@Builder.ObtainVia</code> annotation on the fields to indicate alternative means by which the value for that field/parameter is obtained from this instance. + For example, you can specify a method to be invoked: <code>@Builder.ObtainVia(method = "calculateFoo")</code>. </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> @@ -65,15 +68,11 @@ <@f.smallPrint> <p> - @Singular support for <code>java.util.NavigableMap/Set</code> only works if you are compiling with JDK1.8 or higher. - </p><p> - 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><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. + For remarks on <code>@Singular</code>, see <a href="/features/Builder#small-print">the <code>@Builder</code> documentation's</a> small print. + </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#small-print">Getter/Setter documentation's small print</a> for more information. </p> </@f.smallPrint> </@f.scaffold> |