Wednesday, March 4, 2015

Project Lombok

Lombok  is a plugin that Java developers can use to save time and effort writing repeated code like one we see in data classes. I will describe it with examples and will include a link to video and the project site to download and try.

Consider the following data class Student which has some attributes and access to it Getters/Setters.


Too much code for a data class :-S

Look at Lombok and what it can do :-P


You can also control if you want only getters or setters using the @Getter and @Setter annotation before each attribute.


Now the code looks more pretty and readable as a data class. It has lots of other useful annotations that will save you lots of repeated code.

For example you can look at the @Cleanup annotation and what it does.

References:



2 comments:

  1. Thank you, I had been looking for some online reference to be used in my Java training and your work really helped me.
    Best Java Training in Chennai | Best Java Training in Chennai | Best Java Training in Chennai

    ReplyDelete
  2. Nice blog it is very useful for me. I have to share my website link.
    Each and every year we are providing Cheap and best students Final year projects at Madurai.

    ReplyDelete