|
|
|
|
|
by javanonymous
996 days ago
|
|
Lombok can be used for more than just getters/setters. I personally use the @Builder annotation on records with more than 3-4 fields. I find it much more readable than a long list of arguments to the constructor. It also makes it easy to return a copy of the record where only a few fields have changed: var r = book.toBuilder()
.lastUpdated(now)
.title("...")
.build()
I also use other annotations, but I could work without them if a future version of Java provides a builder-like pattern (or named arguments) |
|