[xstream-user] partial object graph serialization & deserialization

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[xstream-user] partial object graph serialization & deserialization

Erik Eide
Hi

Other than marking fields as transient, are there any other ways to
prevent XStream from serializing or deserializing particular fields
and sub-objects ?

Or vise versa, so that you can specify only those fields which you do
want serialized/deserialized ?

Regards
Erik
Reply | Threaded
Open this post in threaded view
|

RE: [xstream-user] partial object graph serialization & deserialization

Jörg Schaible
Hello Erik,

Erik Eide wrote on Tuesday, November 08, 2005 12:27 AM:

> Hi
>
> Other than marking fields as transient, are there any other
> ways to prevent XStream from serializing or deserializing
> particular fields and sub-objects ?
>
> Or vise versa, so that you can specify only those fields
> which you do want serialized/deserialized ?

you may either
1/ mark a field as transparent
2/ implement your own readObject/writeObject methods
3/ implement an own Converter. Derive from AbstractBasicConverter, if you can create an own String representation of your object

- Jörg
Reply | Threaded
Open this post in threaded view
|

Re: [xstream-user] partial object graph serialization & deserialization

Joe Walnes-2
On 11/8/05, Jörg Schaible <[hidden email]> wrote:

> Hello Erik,
>
> Erik Eide wrote on Tuesday, November 08, 2005 12:27 AM:
>
> > Hi
> >
> > Other than marking fields as transient, are there any other
> > ways to prevent XStream from serializing or deserializing
> > particular fields and sub-objects ?
> >
> > Or vise versa, so that you can specify only those fields
> > which you do want serialized/deserialized ?
>
> you may either
> 1/ mark a field as transparent
> 2/ implement your own readObject/writeObject methods
> 3/ implement an own Converter. Derive from AbstractBasicConverter, if you can create an own String representation of your object

In the latest snapshot of XStream you can also use
XStream.omitField(SomeClass.class, "someField");

http://dist.codehaus.org/xstream/jars/xstream-SNAPSHOT.jar

cheers
-Joe