public static <D> List<D> parseList(InputStream is, Class<D> parseClass) throws ParseException { try { return LoganSquare.parseList(is, parseClass); } catch (Exception e) { throw new ParseException(e); } }
private Object getObject(Cursor cursor, int columnIndex, ParameterizedType fieldType) throws IOException { final Type rawType = fieldType.getRawType(); if (!(rawType instanceof Class)) throw new UnsupportedOperationException(); final Class rawCls = (Class) rawType; final String string = cursor.getString(columnIndex); if (TextUtils.isEmpty(string)) return null; if (List.class.isAssignableFrom(rawCls)) { // Parse list return LoganSquare.parseList(string, (Class) fieldType.getActualTypeArguments()[0]); } else if (Map.class.isAssignableFrom(rawCls)) { return LoganSquare.parseMap(string, (Class) fieldType.getActualTypeArguments()[1]); } else if (rawCls.isArray()) { final Class componentType = rawCls.getComponentType(); List<?> list = LoganSquare.parseList(string, componentType); return list.toArray((Object[]) Array.newInstance(componentType, list.size())); } return LoganSquare.parse(string, rawCls); }