Hacker News new | ask | show | jobs
by meirelles 3009 days ago
For Java exists the Project Lombok, it works pretty well for this purpose, you can use getters and setters without polluting the code with auto-generated stuff. Have some other cool features like fluent accessors, builders, auto cleanups for close() and plugins for IDEs. IMHO every Java programmer should check it out.
3 comments

My favorite is immutables (https://immutables.github.io/). It's really frictionless and at this point it feels like an extension of the language to me. It also lets you fall back to mutable types when you need them, despite the name.
Or AutoValue (https://github.com/google/auto) for something a bit less involved - Eff. Java 3 recommends it as an alternative to writing equals/hashcode et. all by hand.
Nowadays its quite nice. There used to be some pain with regards to IDE integration, but the IntelliJ Plugin works very well.

Just be aware that Lombok bleeds into other areas as well, e.g. you'll need a recent version of Sonar to properly calculate coverage.