4.6. Abandoning Metadata

In all the scenarios discussed so far, class metadata is part of the serialization format. The first time an instance of a particular class is written, the class metadata is also written, including the class name, SUID, field names, and field types. When default serialization is used, the field names are discovered by reflection, and the SUID is calculated by taking an SHA-1 hash of the class metadata. When you override these behaviors by specifying serialVersionUID or serial-PersistentFields, you are not eliminating metadata. Instead, you are just taking explicit control of what the metadata looks like.

The serialization mechanism also provides several hooks that allow you to skip sending metadata at all. This section ...

Get Component Development for the Java™ Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.