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.
JEP 359 record versus @Data and @Value - Spring Tutorial
From the course: Learning Lombok: Streamlined Java Programming
JEP 359 record versus @Data and @Value
- [Instructor] It's been a common complaint with Java that it is too verbose or involves too much ceremony, especially for simple data carriers. Most protests are over boilerplate code involved with creating constructors, equals, hashCode, toString, and accessor methods. Okay, I mean that's what Lombok is meant to address, right, with the immutable Data annotation and immutable @Value annotation. Well, it appears that the JCP has caught on to all of the complaints and provided an initial answer to this back in preview release with JEP 359 for JDK 14. By making available an immutable Data carrier class, a type called the Record. JEP 384 provided a second preview in JDK 15, and this has now been finalized in JEP 395 with JDK 16. Well, does this mean that learning Lombok is a waste? No. The Record class only answers a limited use case, whereas Lombok provides solutions for many different scenarios. So one might ask, what are the…
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
-
-
-
Abating setter and getter code bloat4m 52s
-
(Locked)
Adding but reducing ToString, Equals, and HashCode methods4m 22s
-
(Locked)
Pairing down constructor bloat3m 57s
-
(Locked)
One annotation to rule them all5m 20s
-
(Locked)
Playing nicely with Spring @Autowired4m 28s
-
(Locked)
JEP 359 record versus @Data and @Value5m 6s
-
(Locked)
Challenge: Reduce boilerplate code in POJOs3m 29s
-
(Locked)
Solution: Reduce boilerplate code in POJOs5m 23s
-
-
-
-