@Override public synchronized JSONObject getItem(Class<?> clazz, String serverId) throws NetworkException { checkConnection(); readCount++; try { return DummyObjectSource.getInstance() .toJSON(new DummyObject("dummy" + serverId, 0, null)) .put("id", Integer.parseInt(serverId)); } catch (JSONException e) { e.printStackTrace(); return null; } }
@Override public synchronized List<JSONObject> getItems(Class<?> clazz, JSONObject search) throws NetworkException { checkConnection(); List<JSONObject> items = new ArrayList<>(); try { for (int i = 0; i < 10; i++) { readCount++; JSONObject data = DummyObjectSource.getInstance() .toJSON(new DummyObject("dummy" + (currentPK++), 0, null)) .put("id", currentPK); items.add(data); } } catch (JSONException e) { throw new RuntimeException(e); } return items; }