简体   繁体   中英

Serialization and Deserialization of private fields

I have a class in which I have defined all instance variables as private. I don't have getters and setters for all the fields. Now if I have such object after desrialization then how can i access the private instance variables.

You can access them the same way as before: Only inside the instance that is declaring the fields.(*) Nothing changes after serialization and deserialization.

(*) And of course via reflection as you could before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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