I have a class that I want to use Lombok.Builder and I need pre-process of some parameters. Something like this:
@Builder
public class Foo {
public String val
This works for me, not a complete solution, but quick and easy.
@Builder
@AllArgsConstructor
public class Foo {
@Builder.Default
int bar = 42;
Foo init() {
// perform values initialisation
bar = 451; // replaces 314
return foo;
}
static Foo test() {
return new FooBuilder() // defaults to 42
.bar(314) // replaces 42 with 314
.build()
.init(); // replaces 314 with 451
}
}