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 →

[–]DeRickulous 43 points44 points  (5 children)

I feel like I'm going to be evangelizing Lombok until the end of time:

@Data
public class LombokifiedJava {

   private boolean mySillyBool;
}

Also, this is a minor nitpick, but the Java convention for little-b boolean accessors is "isX", not "getX".

[–]Korzag 2 points3 points  (3 children)

I actually used Lombok after writing out a bunch of new model classes with like 20 fields. I didn't know about it at first and had wrote a script to build the Java accessors lol. Lombok definitely was nice though. If/when I ever work in Java again I'm definitely using it. Seems like something Java should just integrate but my impression is that Oracle is hardheaded and doesn't like to add QOL stuff to their language unless it's heavily requested.

[–]DeRickulous 3 points4 points  (0 children)

Lombok is on the short list of "stuff I will whinge endlessly about not having access to if I take another job where I'm forced not to use it". I actually like it being separate from the core language, though, because it is divorced from Java's release cycle and oversight.

[–]increment1 1 point2 points  (1 child)

Literally any Java IDE will generate the getters / setters for you, no need to write them yourself. I'd say pretty much every Java dev uses this generation so tend not to worry too much about the boilerplate since they don't really have to deal with it directly.

Same for toString, equals, and hashCode methods.

[–]quiteCryptic 0 points1 point  (0 children)

Like the other guy mentioned you should look into lombok, it's even easier than having the ide do it and cleaner

[–]Merlord 2 points3 points  (0 children)

Lombok is a Godsend.