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

Can Serializable object contain non-serializable member variables that get serialized  RSS feed

 
Shawn Garner
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Serializable object contain non-serializable member variables and have them get serialized. For example.


Say the Wheel and Hood classes do NOT implement Serializable.
Will wheel and hood get serialized or do the HAVE to implement Serializable to get serialized?

Thanks,
Shawn
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They have to implement serializable.

If you had something that implements serializable that you want to prevent from being serialized - the opposite of your current problem - you could make the variable reference "transient".
 
Shawn Garner
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information. Helps a lot.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!