owlike/genson

Handle SortedMap

Opened this issue · 0 comments

Dear Sir,

SortedMap can not be handled due to code below. Could you change if (TreeMap.class.equals(typeOfMap)) to if (typeOfMap.isAssignableFrom(TreeMap.class)) to support SortedMap?

`DefaultConverters.MapConverterFactory{
private <K, V> MapConverter<K, V> createConverter(Class<?> typeOfMap,
KeyAdapter keyAdapter, Converter valueConverter) {
if (Properties.class.equals(typeOfMap))
return new PropertiesConverter(keyAdapter, valueConverter);

  if (Hashtable.class.equals(typeOfMap))
    return new HashTableConverter<K, V>(keyAdapter, valueConverter);

  if (TreeMap.class.equals(typeOfMap))
    return new TreeMapConverter<K, V>(keyAdapter, valueConverter);

  if (LinkedHashMap.class.equals(typeOfMap))
    return new LinkedHashMapConverter<K, V>(keyAdapter, valueConverter);

  return new HashMapConverter<K, V>(keyAdapter, valueConverter);
}

}`

Thanks,
Baogang