简体   繁体   English

反序列化时JVM如何找到对象类的serialVersionUID

[英]How JVM find serialVersionUID of the class of the object at the time of deserialization

Suppose I have an entity class which implements the Serializable interface and now I persisting that serialized object in the database. 假设我有一个实现Serializable接口的实体类,现在我将该序列化的对象保留在数据库中。 How JVM find serialVersionUID of the class of the object at the time of deserialization. JVM在反序列化时如何找到对象类的serialVersionUID。

When object serialized it's class name and serialVersionUID stored in stream. 对象序列化后,它的类名称和serialVersionUID存储在流中。

When object deserialized JVM load class by name and compare serialVersionUID of loaded class with stored value. 当对象按名称反序列化JVM加载类时,将加载的类的serialVersionUID与存储的值进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM