Results 1 to 2 of 2

Thread: Serialize this!

  1. #1
    dustybray is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default Serialize this!

    Well, this may not be too "advanced" for most people, but I'm unsure how to approach it...

    I have a package written by someone else whose objects I now need to serialize. The package has several classes with complex relationships (objects frequently share the same objects), lots of inheritance, and is lacking in default constructors. (It's also lacking in documentation...)

    The primary object I want to serialize takes two other objects from the package as parameters. It processes up to a certain point, and then I want to store it's exact state for later use. I've taken a stab at serializing it with no luck, but lots of NullPointerExceptions.

    Is there any sure-fire method for serializing complex objects like this? (For instance, making every single class serializable or something.) Do I need to add default constructors? If so, do I actually need to add logic to them, or can they be empty? Would I basically need to get a PhD in understanding this package for this to work?

    I don't care too much about the cost of storing the object, just that I can get it back in the exact state.



  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    i have found a good bit of success using some serializer library, such as "SOJO" or "JSONSerializer" (both sourceforge projects). They usually work with bean pattern methods and require objects have default constructors, but are capable of serializing complex objects with nested lists and other objects very well. Where as to use java serialization is more difficult, requiring they implement serializable and you would likely need to provide your own readObject() and writeObject() methods in some of the more complex classes.

Similar Threads

  1. Using JSTL to capture HTTP referer data and serialize into a variable
    By jeremy.wilson in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 05-19-2011, 01:44 PM
  2. Replies: 3
    Last Post: 10-15-2010, 04:03 PM
  3. To serialize or not to serialize?
    By XmisterIS in forum New To Java
    Replies: 2
    Last Post: 09-21-2010, 02:37 PM
  4. Can I Serialize "this"??
    By Sandia_man in forum New To Java
    Replies: 8
    Last Post: 08-29-2010, 04:36 AM
  5. serialize to web service?
    By theartz in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2008, 02:39 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts