Path Converter in XStream

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

Path Converter in XStream

Stanislav Ivanov
Hi, people!


First of all, thanks for XStream. It's simply awesome.
Would you mind answering two questions?

1:
I have recently encountered necessity in using java.nio.file.Path field in POJO class which I map to XML using XStream.
I didn't find any converter for it in XStream (only for the java.io.File).

Of course, it's super-easy to implement custom SingleValueConverter for Path, however, I was a bit suprised with the absense of this functionality in XStream.

Is it because you are (maybe) stricted to the Java version 6?

2:
Why SingleFileConverter interface is not generic?
It could have eliminated the necessity in using class cast in SingleFileConverter#toString(Object o) method.
Are there any possible difficulties in making it generic (besides breaking backward compatibility)?

Thanks in advance.
--
Stanislav Ivanov

tel. +7911-934-54-52
skype: ivStas
Reply | Threaded
Open this post in threaded view
|

Re: Path Converter in XStream

Jörg Schaible-2
Hi Stan,

Stanislav Ivanov wrote:

> Hi, people!
>
>
> First of all, thanks for XStream. It's simply awesome.
> Would you mind answering two questions?
>
> *1:*
> I have recently encountered necessity in using *java.nio.file.Path* field
> in POJO class which I map to XML using XStream.
> I didn't find any converter for it in XStream (only for the
> *java.io.File*).
>
> Of course, it's super-easy to implement custom *SingleValueConverter *for
> *Path*, however, I was a bit suprised with the absense of this
> functionality in XStream.
>
> Is it because you are (maybe) stricted to the Java version *6*?

XStream did never contain converters for any type and this type has not been
requested up-to-now. Feel free to open a JIRA issue as enhancement request.

> *2:*
> Why SingleFileConverter interface is *not generic*?
> It could have eliminated the necessity in using class cast in
> SingleFileConverter#toString(Object o) method.
> Are there any possible difficulties in making it generic (besides breaking
> backward compatibility)?

XStream 1.4.x is still Java 1.4 compatible. XStream 1.5 will require Java 6.
Howver, there is no requirement that a Converter/SingleValueConverter
handles one type only.

Cheers,
Jörg


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

    http://xircles.codehaus.org/manage_email