Morphia 0.99
Whenever a new untypedTypeConverter is added to DefaultConverters it is added
*after* the PassthroughConverter, meaning "getEncoder(Class c)" never finds the
new converter but returns the PassthroughConverter instead. (Because it's
isSupported() method returns true.)
Currently, to correct, you need to remove the PassthroughConverter, add the new
converter, then re-add the PassthroughConverter. Given "getEncoder(Class c)" is
private, the code looks a little messy:
DefaultConverters converters = morphia.getMapper().getConverters();
Method getEncoder = DefaultConverters.class.getDeclaredMethod("getEncoder",
Class.class);
getEncoder.setAccessible(true);
TypeConverter passthroughTypeConverter = (TypeConverter)
getEncoder.invoke(converters, PassthroughTypeConverter.class);
converters.removeConverter(passthroughTypeConverter);
converters.addConverter( ... new untyped converted ... );
converters.addConverter(passthroughTypeConverter);
Steve.
Original issue reported on code.google.com by steve.ey...@gmail.com on 22 Jan 2013 at 3:00
Original issue reported on code.google.com by
steve.ey...@gmail.com
on 22 Jan 2013 at 3:00