6 ms·
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.
by meirelles 9y 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.
- sgift 9y agoOr AutoValue (https://github.com/google/auto 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.
- MrBuddyCasino 9y agoNowadays 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.
- absove 9y agoMy favorite is immutables (https://immutables.github.io/ 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.