Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Related to Serialization

Thread view: 
qazmlp1209@rediffmail.com - 03 Apr 2006 09:56 GMT
public class myClass implements Serializable
{
 private int intData ;
 private String stringData ;
 private myEnum enumData ;
 private Collection<someOtherClass> someOtherObjCol ;

 // Other parts

 static final long serialVersionUID = 1L;

}

My understanding is given below, to make myClass objects eligible for
serialization:
- int, String data are serializable by default. So, nothing
additionally needs to be done for them.
- All enum(introduced in Java 1.5) objects are serializable by
default. So, nothing additionally needs to be done for them.
- someOtherClass should implement the Serializable.

So, to make myClass objects serializable, I should just make
someOtherClass objects to be Serializable.
I assume no other changes are required.

Can anybody confirm this?
Bart Cremers - 03 Apr 2006 10:20 GMT
An extra thing is you need to make sure the Collection implementation
used implements Serializable. This goes for all standard collection
classes in the jdk, but if you happen to use a custom implementation
you migth get errors (Collection does not extend Serializable!!).
Further, you need to make sure that every member proeprty of
someOtherClass also is serializable or declared transient, and so on
and so on.

Regards,

Bart


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.