java - Is the default serialized form appropriate in this case -


in effective java second edition, bad example of use of default serialized form given class:

// awful candidate default serialized form public final class stringlist implements serializable {     private int size = 0;     private entry head = null;     private static class entry implements serializable {         string data;         entry next;         entry previous;     }     ... // remainder omitted } 

the reason given "the default serialized form painstakingly mirror every entry in linked list , links between entries, in both directions." , goes on should serialize class array of strings.

in java ee 6 tutorial example - the order application. in it, there's class part uses default serialized form , looks this:

public class part implements java.io.serializable {     private static final long serialversionuid = -3082087016342644227l;     private date revisiondate;     private list<part> parts;     private part bompart;     private serializable drawing;     private string description;     private string partnumber;     private string specification;     private vendorpart vendorpart;     private int revision;     ... } 

since part contains list of parts, don't have same problem? default serialized form recursively serialize every part object, contained within part object.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -