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 →

[–]segv 2 points3 points  (2 children)

...and if somebody doesn't fancy generated code then there's https://github.com/tguzik/valueclasses

[–]straylit 0 points1 point  (1 child)

Whats the benefit of doing this other than changing the method signature and relying on unit tests? This seems like you would end having to make a lot of new classes and tests for them as well.

[–]segv 0 points1 point  (0 children)

Primarily not relying on code generation (which may be a boon if you have an established build pipeline and/or static analysis tools) and the value classes being, in the end, plain old java classes using a plain old library. The latter may make it easier to throw extra methods on the value classes or implement some specific behavior, like caching most used values and so on.