Writing a new Model comes with the addition of a lot of boiler plate code. Free up your entity classes with help from Project Lombok.
Writing a new Model/Data comes with the addition of a lot of boiler plate code. Boiler plate code is the code that is repetitive throughout application and has little change in its implementation.
The common step in creating new POJO or Model class is writing Getters, Setters, Constructors, To String methods, Equals method, etc. Even if the IDEs offer to generate them for the user, it still doesn't decrease the amount of repetitive code that goes in these methods.
Lombok is armed with annotations that take care of boiler plate code.
Val** - **Creates a local variable with val which will be initialized based on initialization expression.The local variable will also be made final.
Var** - **Works exactly like Val but the local variable is not declared final.
@Setter- Add setter for all variables.
@Getter- Add getter for all the variables.
@RequiredArgsConstructor- Generates constructor for each field.
@NoArgsConstructor- Creates a non-parametrized constructor.
@AllArgsConstructor- Creates a parametrized constructor containing all fields.
@ToString- Creates toString method.
@EqualsAndHashCode- Creates Equals and Hashcode implementation for fields in the class.
@Value- Short for final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter.
@Data- It is a quick way of combining features of @ToString, @EqualsAndHashCode, @Getter, @Setter and @RequiredArgsConstructor.
@Builder- Makes instantiation of class easier and provides a way to statically initialize fields in a class.
@NotNull- Makes sure the value of object is not null. This is highly beneficial when dealing with data access object and saves risk NullPointerException that may go unchecked.
What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).
This "Java Tutorial for Beginners" Full course will help you master all the major concepts in java such as Arrays, Polymorphism, Abstraction, Inheritance, and Collections.
In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...
Java File class represents the path of directories and files. It provides the methods for renaming, deleting, and obtaining the properties of file or directory.
Java For loop provides a concise way of writing the loop structure. For loop consumes the initialization, condition and increment/decrement in one line.