Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Making class fields non serializable using PropertyDescriptor  RSS feed

 
Slavko Perevalov
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all readers of this topic!


Suppose I have a class A with set of fields and method that makes em non-serializable:



And class B that extends class A and has static initializer that calls A.makePropertiesTransient :


Now comes the question When I create new instance of B method call makePropertiesTransient(B.class) is executed so all inherited fields in B become transient. But I found that for superclass (i.e. class A) they are also become transient so serialization process for instance of class A skips all fields too.
Could you suggest how to avoid propagation of transient properties to superclass, so instances of class A would be serialized completely, but instances of class B not ?
Thank you!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!