code: public JSONObject toJSON(Constraint o) throws JSONConverterException {
          ConstraintConverter c = java2json.get(o.getClass());
          if (c == null) {
              throw new JSONConverterException("No converter available for a constraint with the '" + o.getClass() + "' className");
          }
          return c.toJSON(o);
      }
docs: Serialise a constraint.
  @param o the constraint
  @return the resulting encoded constraint
  @throws JSONConverterException if the conversion failed