Hello,

 I am new to XStream, I got 95% of my task done in nearly no time, but now
I am stuck with trying to serialize the following class:

class MyClass {
    private String name;
    private Pattern pattern;
    // few more fields

    private ColumnPrinter<?> printer;
}

The printer can be an instance of any subclass (possibly anonymous) of the
ColumnPrinter interface. All must implement the getId() method and all are
registered in a global registry (by calling the method ColumnPrinter<?>
getPrinter(String id))

I would like to save all the fields the usual way, but for the printer, I
would like to save its id only (say as <printer>12</printer>). Then when
deserializing the id should be read, and the proper instance should be
looked up in the global registry.

I am not sure how to do that. Can anybody help?

Thanks
Jirka

Reply via email to