Hi Eric,
Eric Lentz wrote:
>>
>> You are been able to set it without this additional declaration:
>> xstream.omitField(Y.class, "z");
>>
>> What's the purpose of the generated XML? Do you want to deserialize it
>> later
>> on?
>>
>> Cheers,
>> Jörg
>>
>
> Jörg,
>
> Right you are! That's better yet. I tried using omitField, but I was
> thinking that the base class would be the one where XStream would pick up
> the values of the upper-level classes. So I had something more like
> omitField(X.class, "z"), which of course didn't work. This is my first
> XStream work, so newbie stuff I guess.
>
> Purpose: I will deserialize later, but the values I'm omitting are for an
> underlying UI framework whose values will not be relevant at the time of
> deserializing. So I'm happy to not have those values populated anyway. I
> just want the values of the base object. No super class values are
> required at all.
I guessed something like that. As alternative for your case you might then
implement a writeReplace method in X (see documentation for Java
serialization) where you create a replacement object with the relevant data
and in the replacement object's type you'll implement a readResolve method
that will instantiate again an instance of X.
Hope this helps,
Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email