I have run into a problem using XStream to serialize and deserialize XML
streams. The following is my scenario:
public interface MyInterface {
}
public class MyObjectA implements MyInterface {
private int x; ..
}
public class MyObjectB implements MyInterface {
private String test; ...
}
public class ClassThatNeedsTransformation {
private MyInterface x;
}
While XStream is able to serialize the ClassThatNeedsTransformation based
on the type of object that is held by it, I am having problems getting
XStream to deserialize the same based on the specific type held in "x". I
read up some docs and it seems to indicate that I need to provide XStream
with a "default" implementation class for the interface in which case, I
lose the flexibility to store either of the concrete implementations of the
interface. Wanted to know if this is indeed a limitation of XStream and if
no, how I would overcome the same. Appreciate your help on the topic.
Venkatesh