I\'ve already seen this: How to test in java that a class implements serializable correctly
I just have a more general question. If you create an object (say a circle) l
Very simple answer.
Let's say you live in a certain province of good ol Canada that requires all your business communication to be conducted in French.
The name of your business is la chance. It performs debt-collection, spam-mail marketing and user tracking services.
Your parent company is la connerie. Your company does not have the facility to conduct debt-collection, spam-mail marketing and user tracking services in French. Anyway, your parent company la connerie conducts all transactions for your company anyway and they have the facility to conduct debt-collection, spam-mail marketing and user tracking services in French. So your company is safe from being raided by the provincial government authorities - no worries.
Actually la connerie does not have facilities to conduct debt-collection, spam-mail marketing and user tracking services in French because it is actually owned by a holding company du fumier. And du fumier has the facilities to conduct debt-collection, spam-mail marketing and user tracking services in French and does so for all its child entities.
So every little business entity under the du fumier umbrella can safely declare that they IMPLEMENT French debt-collection, spam-mail marketing and user tracking services without needing each of themselves the facilities to conduct such French business communication, because they depend on du fumier to do it for them.
One day, your company decided to acquire another company les merdes du chevre and their business is debt-collection. The company is newly set up and is actually an empty shell. but it is safe from the provincial French linguistic authorities because it can depend on your company to perform debt-collection in French. So les merdes du chevre can happily declare that they IMPLEMENT French debt-collection services without lifting a finger to do anything about it.
The next week, your company acquires another company les crapes des crabes whose business is selling crabby by-products. However, they do not have the facilities to sell crabby by-products in French. And because of that you will have to create a dept to IMPLEMENT selling crabby by-products in French. And failing to do so, the provincial linguistic authorities would take the EXCEPTION of hauling your company to court for not IMPLEMENTING selling crabby by-products in French.
But you can escape the prosecution/persecution by the linguistic authorities if you declare that les crapes des crabes is a TRANSIENT entity. You acquired it with intention of transferring it to british columbia and that you never had any intention to actively use that company to sell crabby by-products in the province.
All of the instance variables also need to be serializable as well. This can cause problems when you're working with an external library and your "serializable" class holds a reference to a non-serializable class.
Yes, it's all you need as long as the transitive closure of all the referenced objects are all serializable.
Note this doesn't mean the deserialized object will actually work - that depends on the semantics of "Circle". The easiest way to lose out is becase the new object will be a copy, not the identical object.