} else if (source instanceof List) {
return new ListModelList((List)source, true);
} else if (source instanceof Map) {
return new ListModelMap((Map)source, true);
} else if (source instanceof Object[]) {
return new ListModelArray((Object[]) source, true);
} else if ((source instanceof Class) && Enum.class.isAssignableFrom((Class)source)) {
return new ListModelArray((Object[]) ((Class)source).getEnumConstants(), true);
} else {
throw new UiException("Expects java.util.Set, java.util.List, java.util.Map, Object[], Enum Class, or ListModel only. "+source.getClass());
}
} else {
Constructor emptyConstructor = ClassUtils.getConstructorIfAvailable(targetClass, new Class[] {});