Project Lombok
Spice up your Java
Topics for Today
Why to use Lombok?
Features
Why not to use Lombok?
Boilerplate-
The biggest trouble in Java
The Project Lombok
The project Lombok aims to identify the
boilerplate codes (or patterns) in Java and
replace them with simple annotations.
Designing a POJO
The POJO Class
The POJO Class
What if I need a different Impl?
Fail Fast Null Check
Fail Fast Null Check
ToString
ToString
Equals and HashCode
Equals and HashCode
All in One
Getters
Setters
ToString
Equals
Hashcode
Constructor witht Fields
De-Lombok
A utility to convert lombok code from run-time to
compile time, so you can share the code with
those who don't like lombok.
<target name="delombok">
<taskdef
classname="lombok.delombok.ant.DelombokTask"
classpath="WebRoot/WEB-INF/lib/lombok.jar"
name="delombok" />
<mkdir dir="src-delomboked" />
<delombok verbose="true" encoding="UTF-8" to="src-
delomboked"
from="src" />
</target>
De-Lombok
java -jar lombok.jar delombok src -d src-delomboked
Java Command Line
Ant Task
●
Most of this can be achieved by using a simple
IDE e.g. Eclipse
●
Lombok is unable to identify the constructors
of the super class
Limitations and Criticism
References
● https://projectlombok.org
● http://jnb.ociweb.com/jnb/jnbJan2010.html

The Lombok Project