capnproto-java
capnproto-java copied to clipboard
Return Builder on set* Methods
trafficstars
Better support for the builder pattern.
Hi, I'm not sure if I got all the methods properly. In my limited tests, the output seems fine.
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.