Please have a look about the following example which is restricting me to be Serialized, due to the presence of interfaces like LIST(COLLECTION is not a SErialized interface.)
This statement is completely *not* true. All implementations of collections in the current runtime are serializable. What may not be serializable are the items in the collections. To get the collection serializable, you will need to get the items in the collections serializable -- items which you have not shown.
How can I avoid these situations?? Can I make the class serialized, only after making the LIST as TRANSIENT???
Unfortunately, you have completely missed the whole point of this topic. I will try to explain again... pretend you need to get a teleport CAR (yes, a real car from one planet to another using teleportation). But you can't because the engine is not serializable -- hence, the car isn't serializable.
You are arguing for ways to get the engine transient, but it is really too complex. My argument is, even if you are able to do it, all you going to get is to teleport a car without the engine on the other side!!
So, to answer your question... yes, if you can get all the items which are not serializable transient, then the whole class can be serializable. But... will the class work on the other side?
Thats fine Henry!!
Really?!? You really need to read the article that I linked to. Then you need to followup to get up to speed on serialization first. Because transient is not enough !! You can probably get that car teleported, and working, but you probably need to use readObject() and writeObject() methods, to send the engine specs over, and have mechanics on the other side rebuilt them. (hmmm, so I butchered this analogy, sorry...
)
Henry
[ September 09, 2008: Message edited by: Henry Wong ]