What is Benefit of Converter?

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

What is Benefit of Converter?

Raj
Hi


What is the purpose of com.thoughtworks.xstream.converters.Converter Class.


I look for demo
http://xstream.codehaus.org/converter-tutorial.html


Without converter class, the output is

<person>
  <name>Guilherme</name>
</person>

With converter class, the output is
<person>
  <fullname>Guilherme</fullname>
</person>

But we can achieve output same as tag name <fullname> with

@XStreamAlias("fullname")
private String name;

So what is the benefit of using converter.

Regards
Raj


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: What is Benefit of Converter?

Jörg Schaible-2
Hi Raj,

Raj wrote:

> Hi
>
>
> What is the purpose of com.thoughtworks.xstream.converters.Converter
> Class.
>
>
> I look for demo
> http://xstream.codehaus.org/converter-tutorial.html
>
>
> Without converter class, the output is
>
> <person>
>   <name>Guilherme</name>
> </person>
>
> With converter class, the output is
> <person>
>   <fullname>Guilherme</fullname>
> </person>
>
> But we can achieve output same as tag name <fullname> with
>
> @XStreamAlias("fullname")
> private String name;
>
> So what is the benefit of using converter.

It is a simple example of how to write one.

;-)

- Jörg


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

    http://xircles.codehaus.org/manage_email