Home / Companies / Starburst / Blog / Post Details
Content Deep Dive

Serialization

Blog post from Starburst

Post Details
Company
Date Published
Author
Jordan Zimmerman
Word Count
1,461
Language
English
Hacker News Points
-
Summary

The text explores a serialization framework in Java, specifically focusing on converting Java objects into JSON tokens using Java 19's enhanced features like record patterns and pattern matching for switch statements. It highlights the straightforwardness of serializing simple Java objects such as primitives, strings, and enumerations, while noting the complexities traditionally associated with Java class serialization. With the advent of Java records, extra metadata like annotations is no longer necessary, simplifying the serialization process. The framework restricts serialization to specific Java instances that do not require extra metadata, and the code implements this using a deceptively simple interface, JsonSerializer. The text further delves into the mechanics of serializing collections and records, demonstrating the use of Java's enhanced switch statements and pattern matching to streamline this process. It emphasizes the compactness and simplicity of the framework, which can be run in jshell, and provides a brief overview of setting up and testing the serialization process using Java 19's preview features.