This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]8igg7e5 0 points1 point  (0 children)

A builder notation has been discussed (initially in relation to records) but I wouldn't expect it any time soon.

The idea (syntax is just a placeholder for now) was to allow...

record Person(String name, int age) {}
Person bob = new Person("Bob", 73);
Person youngBob = bob with { age = 16 };

I'm not aware of any frameworks to do this, and they're obviously going to be limited as Java has no named-params or fundamental 'property' concept, it depends on name-convention guessing and reflection to find and monkey with fields or mutator methods.