Hi Benny,
Benny Kannengiesser wrote:
> Hi,
>
> I have a question concerning the new feature of the latest release 1.4.2,
> that now the XStreamConverter annotation takes additional parameters
> (very good feature and just what I need).
>
> How does the caching of the converter instances work now?
> Since the parameters are passed on to the constructor of the respective
> converter, the converters contain state and the caching could become more
> complicated.. Or is there no caching any more in these cases?
>
> Thanks for any information.
the basic functionality did not change i.e. there's a XStream instance
global registry for all non-local converters and the converters declared
with the annotations are registered in the sequence they are found. In the
case of two converters handling the same type, the last one registered is
used.
If you want to reuse the converter implementation for multiple types (with
different parameters), you might either declare the converter to be local or
use a converter implementation that takes a Class type as argument and that
will then handle only this class. The current type is automatically added to
the list of possible constructor arguments. E.g. the ToStringConverter can
be declared therefore for several types with a class annotation.
Hope this helps,
Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email