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.
Mutable setters using Lombok @With - Spring Tutorial
From the course: Learning Lombok: Streamlined Java Programming
Mutable setters using Lombok @With
- [Instructor] With project file 02 05, begin Lombok loaded in IntelliJ. Let's dig into some other issues that we can run into with immutable classes and how we can overcome these with the @with annotation. Let's go ahead and navigate to our employee DTO record and examine a code sample, or we might think about implementing this scenario. Looking at the employee DTO record, we already understand that this class is implicitly immutable because it's a record, and we see some fields that are marked non-null. This forces whoever might use this object to ensure that those particular fields are not null, and that really makes sense, right? Since we expect an employee type record to have at least a first name, a last name, possibly email, and a status, typically the names do not change but the employee status is another matter. If we're passing this employee DTO record around, we probably are going to have a functional business…
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
-
-
-