capnproto-java icon indicating copy to clipboard operation
capnproto-java copied to clipboard

Return Builder on set* Methods

Open brianv0 opened this issue 9 years ago • 2 comments
trafficstars

Better support for the builder pattern.

brianv0 avatar Mar 16 '16 20:03 brianv0

Hi, I'm not sure if I got all the methods properly. In my limited tests, the output seems fine.

brianv0 avatar Mar 16 '16 20:03 brianv0

There are drawbacks to doing this if you ever want to implement some sort of class hierarchy for your structs. A setter from a base class will return a base builder, making it impossible to use a setter from a subclass.

I know it's not a problem now, because there is no struct inheritance, but it'd be nice to have that option at some point.

idlsoft avatar Mar 31 '22 15:03 idlsoft