public IComponent getImplementationOfInterface(String name) { try { JSONArray array = json.getJSONObject(name).getJSONArray("implementations"); return get(array.getString(0)); } catch (JSONException ex) { ex.printStackTrace(); } return null; }
public Vector list() { Vector v = new Vector(); Enumeration e = json.keys(); while (e.hasMoreElements()) { try { String iface = (String) e.nextElement(); JSONArray array = json.getJSONObject(iface).getJSONArray("implementations"); for (int i = 0; i < array.length(); i++) { String name = (String) array.get(i); if (!v.contains(name)) v.addElement(name); } } catch (JSONException ex) { ex.printStackTrace(); } } return v; }
public Vector getComponentsFromInterface(String name) { try { Vector v = new Vector(); JSONArray array = json.getJSONObject(name).optJSONArray("implementations"); for (int i = 0; i < array.length(); i++) { String compname = (String) array.get(i); if (!v.contains(compname)) { v.addElement(compname); } } return v; } catch (JSONException ex) { ex.printStackTrace(); } return null; }