From the course: Learning Lombok: Streamlined Java Programming
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Simplifying null checks and removing bloat - Spring Tutorial
From the course: Learning Lombok: Streamlined Java Programming
Simplifying null checks and removing bloat
- Having 0 2 0 2 begin, lombok demo open in IntelliJ. Let's investigate how we might force null checks on our employee entity. Looking at our employee entity class we might have a database table constraint on various columns, so as to ensure that certain fields are non-null. It makes sense to apply these constraints to fields like the last name and the first name. Lombok offers the non-null annotation that actually will force null checking on our fields. Please keep in mind that lombok's non-null is different than the Jakarta validation constraints version or the fine bugs implementation. Those variants are strictly concerned with validation and require third party APIs or custom code to check the validity of the fields. Let's go ahead and apply the non-null to the last name, to the first name and to our employee status. Then click the build button. Once the build is complete go to the project folder, then the build…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Lombok implements a builder design pattern4m 55s
-
(Locked)
Simplifying null checks and removing bloat3m 58s
-
(Locked)
Simplify final local variable declaration4m 40s
-
(Locked)
Mutable local variables versus JEP 286 var4m 22s
-
(Locked)
Mutable setters using Lombok @With4m 17s
-
(Locked)
Challenge: Utilizing simplified Lombok POJOs3m 41s
-
(Locked)
Solution: Utilizing simplified Lombok POJOs8m 19s
-
-
-