Two different converter for the same class

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

Two different converter for the same class

Petr Adamec-2
Good morning,
I have a problem with convertes.
I use two different atributs for Date at my class. The first only for
Date and the second only for time. I have two different converter for
these atributs (DateConverter and TimeConverter).
I use two anotation for those atributs at my class, each of them for
differen atribut of course.

@XStreamConverter(DateConverter.class )
@XStreamConverter(TimeConvertes.class)

At a marshal method I call
context.convertAnother(trmData.getConfigActivationDate());
for date and similar for time. In this code I cannot insert concrete
converter because it is mistake "The method convertAnother(Object,
Converter) in the type MarshallingContext is not applicable for the
arguments (Date, DateConverter) ". So that I register converter before I
use xstream:

TimeConvertes timeConvertes = new TimeConvertes();
DateConverter dateConverter = new DateConverter();

stream.registerConverter(timeConvertes);
stream.registerConverter(dateConverter);


But xstream use only one (the last register) converter for every
atributs which type is Date.class.
I dont know how I can use bouth converter.

Thank you

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Two different converter for the same class

Jörg Schaible-3
Hi Petr,

Petr Adamec wrote at Friday 25 February 2011 12:56:49:
> Good morning,

this list is for announcements. Can you please use the user's list?

- Jörg

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

    http://xircles.codehaus.org/manage_email