TableCellEditor (DomElement element, Class type) { if (Enum.class.isAssignableFrom(type)) { //noinspection unchecked return new ComboTableCellEditor((Class<? extends Enum>)type, false); } final Function<DomElement, TableCellEditor> function = myCustomCellEditorCreators.get(type); assert function != null : "Type not supported: " + type; return function.fun(element); }