From 7a84e760c2008cb38ce26813cd7651cebae43f6f Mon Sep 17 00:00:00 2001
From: Jan Rieke
@SuperBuilder is not compatible with @Builder.
- You can use @SuperBuilder(toBuilder = true) to also generate an instance method in your class called toBuilder(); it creates a new builder that starts out with all the values of this instance. You can put the @Builder.ObtainVia 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: @Builder.ObtainVia(method = "calculateFoo").
+ You can use @SuperBuilder(toBuilder = true) to also generate an instance method in your class called toBuilder(); it creates a new builder that starts out with all the values of this instance.
+ Using toBuilder requires that all superclasses must also have toBuilder = true.
+ You can put the @Builder.ObtainVia 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: @Builder.ObtainVia(method = "calculateFoo").
To ensure type-safety, @SuperBuilder generates two inner builder classes for each annotated class, one abstract and one concrete class named FoobarBuilder and FoobarBuilderImpl (where Foobar is the name of the annotated class).
@@ -65,15 +68,11 @@ <@f.smallPrint>
- @Singular support for java.util.NavigableMap/Set only works if you are compiling with JDK1.8 or higher.
-
- The sorted collections (java.util: SortedSet, NavigableSet, SortedMap, NavigableMap and guava: ImmutableSortedSet, ImmutableSortedMap) require that the type argument of the collection has natural order (implements java.util.Comparable). There is no way to pass an explicit Comparator to use in the builder.
-
- An ArrayList is used to store added elements as call methods of a @Singular marked field, if the target collection is from the java.util package, even if the collection is a set or map. 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 ArrayList 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 java.util recipes for @Singular.
-
The generated builder code heavily relies on generics to avoid class casting when using the builder.
- 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 Getter/Setter documentation's small print for more information.
+ For remarks on @Singular, see the @Builder documentation's small print.
+
+ 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 Getter/Setter documentation's small print for more information.
@f.smallPrint> @f.scaffold> -- cgit