Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
756 stars 55 forks source link

Add flag to add concrete setters for optionals #94

Closed mads-b closed 2 years ago

mads-b commented 2 years ago

In my adventure to replace Immutables.org, I stumbled upon yet another nifty feature:

If you are setting an optional field, you are probably intending to set a concrete value.

So here is this PR that adds setters that take concrete values and wrap them in optional prior to insertion into the record.

Randgalt commented 2 years ago

@mads-b, for completeness, please add a test Record that has Optional components but with addConcreteSettersForOptional not enabled. Basically, make sure all the permutations are tested.

Randgalt commented 2 years ago

@mads-b Looks good - please rebase with master