Hi, John
This sample using calendar works fine to date converter:
http://pastebin.com/bEfk3aZy

Using reference in your beans with this annotation
        @XStreamAlias("date")
        @XStreamConverter(SingleValueCalendarConverter.class)
        private Calendar  date;

Jairo.

2012/2/6 John Fereira <[email protected]>:
> I have been using XStream for quite a while without a hitch but recently was
> presented with a use case that I’m not sure how to resolve.  Essentially I
> have an Hours object that represents the opening and closing hours of a
> location.  The actual open/close fields are  “Time” objects that uses a
> Calendar instance on the back end.   Up until recently the open/closed Time
> objects were always instantiated to a non-null value.   However, for reasons
> that I don’t necessarily agree with I’ve been asked to set the open/closed
> Time objects to a null if a flag (another field in the Hours object) has
> been set to “closed all day” or “open all day”.   The issue that I’m having
> is that I want to serialize  the Hours object and marshall a “openTime”
> element (with the time set to null)  even when the Time object is null.
> I’ve got a “TimeConverter” class that returns true for the canConvert method
> (it is recognizing that a Time.class is being handled) but it doesn’t appear
> that the marshal method is being called if the Time object is a null.



-- 
Sem mais...
Jairo de Almeida
email: [email protected]
msn: [email protected]

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to