Search the web
Sign In
New User? Sign Up
JSX-ideas · Ideas on Java Serialization for XML
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
serialPersistentFields   Message List  
Reply | Forward Message #2173 of 2204 |
Hi Stephen,

"serialPersistentFields" is the approach I was talking about. Here's an example:
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/examples.html

You customize how the object is serialized and deserialized by adding
callback methods to it, readObject and writeObject - JSX will call
these. Within these, you can use the serialPersistentFields (an array
that defines the class's fields for the purposes of serialization - so
they can differ from the actual fields of the class), and GetField and
PutField to read/write them.

So, you can customize how fields are read in, with these virtual
fields that you can process in whatever way you need to before
assigning the values to fields. For serialization, you can write out
the fields as normal.

I recommend having a play around with this. You can use this as a
migration mechanism, to read in the old version and write out the new.
You can inspect the XML to verify it has made the change you intended
to make.

For simple changes, it may be easier to modify the XML directly.

Note: for primitive type changes, JSX automatically converts them to
the expected type.


Here's the JOS spec.
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/serialTOC.html


BTW: There's only one change to serialization in Java 1.6 (very esoteric):

http://java.sun.com/javase/6/docs/technotes/guides/serialization/relnotes6.html

cheers,
Brendan



Mon Jan 8, 2007 1:35 am

egroups_yow
Offline Offline
Send Email Send Email

Forward
Message #2173 of 2204 |
Expand Messages Author Sort by Date

Hi Stephen, "serialPersistentFields" is the approach I was talking about. Here's an example: ...
Brendan
egroups_yow
Offline Send Email
Jan 8, 2007
1:35 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help