Java Records for the intrigued
summary
Java 16 makes Records a standard, generating private final fields, accessors, canonical constructors and equals/hashCode/toString so you stop writing boilerplate; compact constructors let you validate without reassigning fields; Records are final, can’t be extended or declare instance fields, and don’t follow JavaBeans (Introspector won’t find getters). Reflection exposes getRecordComponents, Jackson 2.12 already serializes/deserializes Records out of the box, and Java serialization invokes the constructor during deserialization. Records fit DTOs and value carriers but not JPA entities; Lombok builders need workarounds.
AI-written summary · about
chapters (13)
- 0:00Introduction and Java updates
- 4:25What are Java records
- 11:16Record demo and basics
- 13:01What records can do
- 25:24What records cannot do
- 33:14Records vs Java beans
- 34:56Nesting records and local classes
- 39:16Reflection and annotations on records
- 49:53Serialization of records
- 53:09JSON serialization with Jackson
- 1:00:15Records for database models and DTOs
- 1:05:58Records with sealed classes and pattern matching
- 1:09:48Summary and Q&A
