@Test(dependsOnMethods = {"testRegister"}, expectedExceptions = {JSONConverterException.class}) public void testFromJSonWithNoConverter() throws JSONConverterException { JSONObject ob = new JSONObject(); ob.put("id", "mockView"); ob.put("value", "val"); ModelViewsConverter c = new ModelViewsConverter(); c.fromJSON(null, ob); }
public ModelView fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, ModelViewConverter.IDENTIFIER); Object id = in.get(ModelViewConverter.IDENTIFIER); ModelViewConverter<? extends ModelView> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a view having id '" + id + "'"); } return c.fromJSON(mo, in); }
ModelViewsConverter { public ModelView fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, ModelViewConverter.IDENTIFIER); Object id = in.get(ModelViewConverter.IDENTIFIER); ModelViewConverter<? extends ModelView> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a view having id '" + id + "'"); } return c.fromJSON(mo, in); } }
ModelViewsConverter { public ModelView fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, ModelViewConverter.IDENTIFIER); Object id = in.get(ModelViewConverter.IDENTIFIER); ModelViewConverter<? extends ModelView> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a view having id '" + id + "'"); } return c.fromJSON(mo, in); } ModelViewsConverter(); }
ModelViewsConverter { public ModelView fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, ModelViewConverter.IDENTIFIER); Object id = in.get(ModelViewConverter.IDENTIFIER); ModelViewConverter<? extends ModelView> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a view having id '" + id + "'"); } return c.fromJSON(mo, in); } ModelViewsConverter(); static ModelViewsConverter newBundle(); void register(ModelViewConverter<? extends ModelView> c); Set<Class<? extends ModelView>> getSupportedJavaViews(); Set<String> getSupportedJSONViews(); ModelView fromJSON(Model mo, JSONObject in); JSONObject toJSON(ModelView o); }
ModelViewsConverter { public ModelView fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, ModelViewConverter.IDENTIFIER); Object id = in.get(ModelViewConverter.IDENTIFIER); ModelViewConverter<? extends ModelView> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a view having id '" + id + "'"); } return c.fromJSON(mo, in); } ModelViewsConverter(); static ModelViewsConverter newBundle(); void register(ModelViewConverter<? extends ModelView> c); Set<Class<? extends ModelView>> getSupportedJavaViews(); Set<String> getSupportedJSONViews(); ModelView fromJSON(Model mo, JSONObject in); JSONObject toJSON(ModelView o);  }