How to get multiple XML outputs from same class ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to get multiple XML outputs from same class ?

Ashish<deXter> chougule

My problem is that there are domain objects used across multiple projects .

There are few projects which require to convert these domain objects to XMLs. Each project needs to have its own format.

I am a beginner with xstream and after going through the tutorials I think we can't do this using annotations.(please correct me if I am wrong)

So I looked at the api provided by Xstream class (.alias(....)).
I could manage to get different XML outputs from same object.
But soon I landed  on another problem which was what if someone in my team innocently changed the field name (the alias methods take a string ) that will  break my XML generation. Can I put some kind of constrain so that the compiler could tell me if some thing is changed.(I know this is out of the scope of xstream but.. Would be great if someone could help me out..also I know setter getters would Change but again that will not guaranty that the string in the alias method would change ) 
So please help me with this problem..
How can I cleanly get this "multiple XML outputs from same class " 

<a href="tel:+91%2022%2067235378">+91 22 67235378