Hi,

When CollectionConverter is used with the @XStreamConverter annotation, the 
converter is set up so that it will only accept the TreeMap collection type. 
This is an odd behavior! Is there any way to suppress this initialization 
(CollectionConverter has a constructor that doesn't limit it to just one 
particular type), or to specify some other type, such as ArrayList?

public class ItemList {
    @XStreamConverter(value = CollectionConverter.class)
    public List<String> items;
}

As a workaround, I subclassed CollectionConverter:

public class ItemList {
    @XStreamConverter(value = ListCollectionConverter.class)
    public List<String> items;

    public static class ListCollectionConverter extends CollectionConverter {
        public ListCollectionConverter(Mapper mapper) {
            super(mapper);
        }
    }
}

This did the trick, but it is very counterintuitive.

Dmitry Epstein | Developer
Allied Testing
T + 7 495 544 3694 Ext 443
M + 7 926 215 73 36

www.alliedtesting.com<http://www.alliedtesting.com/>
We Deliver Quality.

Reply via email to