0

What's the easiest way to get rid of this stuff with Xstream:

<myRows class="java.util.Collections$UnmodifiableRandomAccessList" ...

Preferably I'd like to get rid of all the List implementations and deserialize them back to plain ArrayList when reading. I'm already doing basic aliasing for my own classes and that works, e.g.

"foo.bar.MyClass" -> "my-class"
auramo
  • 13,167
  • 13
  • 66
  • 88

1 Answers1

0

You can implement Converter interface to change convert details :`public class MyConverter implements Converter {

public boolean canConvert(Class type) {
    // TODO Auto-generated method stub
    return false;
}

public void marshal(Object source, HierarchicalStreamWriter writer,
        MarshallingContext context) {
    // TODO Auto-generated method stub

}

public Object unmarshal(HierarchicalStreamReader reader,
        UnmarshallingContext context) {
    // TODO Auto-generated method stub
    return null;
}

}

and register your converter :

xStream.registerConverter(new MyConverter());

`

Jason
  • 1,241
  • 8
  • 16