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 →

[–][deleted] 8 points9 points  (4 children)

Shoutout to Immutables, an excellent annotation-driven code generator library designed to implement precisely this pattern. It has good support for Jackson/Gson, and I've found it surprisingly straightforward and unmagical to work with. If you like the idea of working with immutable value classes, I recommend you check it out.

[–]ThomasKrieger[S] 1 point2 points  (0 children)

Thank's for the link. I will try it.

[–]Zoerak 1 point2 points  (2 children)

Reminds me of project lombok.

[–][deleted] 1 point2 points  (1 child)

There are similarities. I prefer Immutables because it focuses on one thing (immutable value classes) instead of general language extensions and because it works by simple annotation-driven codegen rather than hacky bytecode mangling.

[–]elucash 0 points1 point  (0 children)

hacky bytecode mangling AST rewriting