@Test(dependsOnMethods = {"testRegister"}, expectedExceptions = {JSONConverterException.class}) public void testFromJSonWithNoConverter() throws JSONConverterException { JSONObject ob = new JSONObject(); ob.put("id", "mock"); ob.put("value", "val"); ConstraintsConverter c = new ConstraintsConverter(); c.fromJSON(null, ob); }
public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, "id"); Object id = in.get("id"); ConstraintConverter<? extends Constraint> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a constraint having id '" + id + "'"); } return c.fromJSON(mo, in); }
ConstraintsConverter { public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, "id"); Object id = in.get("id"); ConstraintConverter<? extends Constraint> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a constraint having id '" + id + "'"); } return c.fromJSON(mo, in); } }
ConstraintsConverter { public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, "id"); Object id = in.get("id"); ConstraintConverter<? extends Constraint> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a constraint having id '" + id + "'"); } return c.fromJSON(mo, in); } ConstraintsConverter(); }
ConstraintsConverter { public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, "id"); Object id = in.get("id"); ConstraintConverter<? extends Constraint> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a constraint having id '" + id + "'"); } return c.fromJSON(mo, in); } ConstraintsConverter(); static ConstraintsConverter newBundle(); void register(ConstraintConverter<? extends Constraint> c); Set<Class<? extends Constraint>> getSupportedJavaConstraints(); Set<String> getSupportedJSONConstraints(); Constraint fromJSON(Model mo, JSONObject in); JSONObject toJSON(Constraint o); List<SatConstraint> listFromJSON(Model mo, JSONArray in); JSONArray toJSON(Collection<SatConstraint> e); }
ConstraintsConverter { public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException { checkKeys(in, "id"); Object id = in.get("id"); ConstraintConverter<? extends Constraint> c = json2java.get(id.toString()); if (c == null) { throw new JSONConverterException("No converter available for a constraint having id '" + id + "'"); } return c.fromJSON(mo, in); } ConstraintsConverter(); static ConstraintsConverter newBundle(); void register(ConstraintConverter<? extends Constraint> c); Set<Class<? extends Constraint>> getSupportedJavaConstraints(); Set<String> getSupportedJSONConstraints(); Constraint fromJSON(Model mo, JSONObject in); JSONObject toJSON(Constraint o); List<SatConstraint> listFromJSON(Model mo, JSONArray in); JSONArray toJSON(Collection<SatConstraint> e);  }