Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xstream: removing class attribute

How do I remove the class=”Something ” attributes in Xstream .

I use Xstream with annotations

like image 327
Quintin Par Avatar asked Jan 05 '10 17:01

Quintin Par


2 Answers

I read its code and found if your class is not mapper.defaultImplementationOf(fieldType) , it will add the default class attribute for you, unless the class attribute name is null;

So, set this can remove the class=”Something ” attributes

 xstream.aliasSystemAttribute(null, "class");
like image 63
Bleastrind Avatar answered Sep 18 '22 15:09

Bleastrind


This attribute is shown, at least, when it's not obvious which class shall be used. Usage of interface is an example. In situations like that You can try:

xStream.addDefaultImplementation(YourDefaultImplementation.class, YourInterface.class);

.

like image 30
kcpr Avatar answered Sep 20 '22 15:09

kcpr