5 Replies Latest reply: Jan 24, 2012 12:27 PM by 796440 RSS

    Clarification on De-Serialization of a Serializable objects

    912822
      Hello,

      I am writing an application with a Class X that is serializable and that class has one member declared as “protected transient static”.
      I knew that this particular member is not serialized during object serialization hence it is not available (default value will be set) after deserialization.

      To recover this member value, I wrote a default constructor for Class X and initializing my member variable (“protected transient static”) inside that,
      but it seems object construction through deseralization is not happening through constructor.

      If my observation and understanding is right, what is the way Java deserialization uses to reconstruct the object and which member function
      should I override so that this overridden function is called during Deserialization and inside I will restore my “protected transient static” member.


      Best Regards,
      Ananth