DEV Community

Discussion on: Safe Domain Objects with MapStruct and Immutables

Collapse
 
ambitionconsulting profile image
John-Paul Cunliffe • Edited

Great post - and funny how I ended up with the same stack independently.

You should probably mind/note the new type-safe staged builders from java immutables.

This will keep the types safe, make your (nested) instance creation better readable, and allows you (by formatting new builder stages on one line each) to easily refactor parameter replacing - by moving the line up or down.

Basically refactoring is the only problem (partly) unsolved with this stack - but with the staged building at least I am guaranteed to get accurate compile-time errors. In general I love it though.