Wednesday, December 2, 2009

Project Lombok


How much boilerplate code we write in our Java classes? Most of the time it will be minimum 100 lines. Even if we have a simple pojo - we have to write all the getters and setters, toString, equals, hashcode method etc.
Finally with all these code it will be easy to lose any bug which is hidden in the code.

Project Lombok is the answer to this problem (if you think this is a problem :) )

Instead of writing all these boilerplate code we can just give the annotation @Data.
Lombok is completely integrated with Eclipse , so all these generated methods will be visible in the outline view.

To make Lombok work with Javac, just add lombok.jar to the classpath.
Other annotation provided by Lombok is @Getter and @Setter.

Another interesting annotation is @Cleanup - this will help by automatically generate try finally blocks to call close on resource objects.

The full list can be found here - Project Lombok Overview


Project Jigsaw

Project Jigsaw is focused on the goal of modularizing JDK. Such a thing will allow applications to be installed with only the required components of JDK.

In the upcoming Jdk7 SUN's primary goal is to modularize jdk.




No comments:

Post a Comment