i refactored generics in iconverterlocator to how they should be. i
did see something pretty interesting though: we used to have
component.getconverter() which we refactored into
component.getconverter(class) to support multiple converters. but then
checkbox does this:
public <X> IConverter<X> getConverter(Class<X> type)
{
return (IConverter<X>)BooleanConverter.INSTANCE;
}
which seems wrong to me because if i say getconverter(integer.class) i
expect to get a converter that can converter integers not booleans.
so here is what i propose:
formcomponents are "single type" components where the type is well
known. so we should probably have:
class formcomponent {
public FINAL <X> IConverter<X> getConverter(Class<X> type) {
if (type==well_known_formcomponent_type) {
return getConverter();
} else { return super.getConverter(type); }
}
public IConverter<T> getConverter() {
return super.getConverter(well_known_formcomponent_type);
}
}
that way we still have getConverter() without a type param that can
easily be overridden by components
or another solution is to implement checkbox.getconverter(class<T>
type) like this:
if (Boolean.class.isassignablefrom(type)) {
return BooleanConverter.instance; }
else { return super.getconverter(type); }
thoughts?