The problem is that currently there's no way to reduce visibility of #toBuilder().
Which defeats the point in a way, making it possible to construct an object in an illegal state (from the business logic point of view), bypassing the "official" ways of construction.
Adding a modifier, something like @Builder(toBuilder = true, toBuilderAccess = AccessLevel.PRIVATE), would be very beneficial.
P.S.: Thanks for the great job you are doing and all the effort! :)
Builder(toBuilder = true)
is a great feature for making copies of large objects, modifying them along the way.The method is convenient when practicing "rich domain models", more or less like this (very sketchy code ahead):
The problem is that currently there's no way to reduce visibility of
#toBuilder()
. Which defeats the point in a way, making it possible to construct an object in an illegal state (from the business logic point of view), bypassing the "official" ways of construction.Adding a modifier, something like
@Builder(toBuilder = true, toBuilderAccess = AccessLevel.PRIVATE)
, would be very beneficial.P.S.: Thanks for the great job you are doing and all the effort! :)