}
public static DataModel objectAsDataModel(Object object) {
DataModel dataModel = null;
if (object == null)
dataModel = new ArrayDataModel(new Object[0]);
else if (object instanceof DataModel)
dataModel = (DataModel) object;
else if (object instanceof List)
dataModel = new ListDataModel((List) object);
else if (object instanceof Collection)
dataModel = new ListDataModel(new ArrayList((Collection) object));
else if (object.getClass().isArray())
dataModel = new ArrayDataModel(Components.anyArrayToObjectArray(object));
else if (object instanceof ResultSet)
dataModel = new ResultSetDataModel((ResultSet) object);
else {
try {
if (object instanceof Result) {