From ad4c612303201665e2362909fa9bd686847f78ba Mon Sep 17 00:00:00 2001
From: Jan Rieke
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).
- Customizing the code generated by @SuperBuilder
is limited to adding new methods or annotations to the builder classes, and providing custom implementations of builder()
and build()
.
+ Customizing the code generated by @SuperBuilder
is limited to adding new methods or annotations to the builder classes, and providing custom implementations of the 'set', builder()
, and build()
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.
The configurable aspects of builder are:
@@ -43,10 +43,12 @@
The builder() method's name (default: "builder"
)
toBuilder()
(default: no)
+ Person.builder().setName("Jane").build()
instead of Person.builder().name("Jane").build()
and what it should be.
@SuperBuilder(buildMethodName = "execute", builderMethodName = "helloWorld", toBuilder = true)
@SuperBuilder(buildMethodName = "execute", builderMethodName = "helloWorld", toBuilder = true, setterPrefix = "set")