code: public static ObjectName getObjectName(String domain,
                                           Map<String,String> properties)
      throws MalformedObjectNameException
    {
      StringBuilder cb = new StringBuilder();
      cb.append(domain);
      cb.append(':');
  
      boolean isFirst = true;
  
      Pattern escapePattern = Pattern.compile("[,=:\"*?]");
  
      // sort type first
  
      String type = properties.get("type");
      if (type != null) {
        cb.append("type=");
        if (escapePattern.matcher(type).find())
          type = ObjectName.quote(type);
        cb.append(type);
  
        isFirst = false;
      }
  
      for (String key : properties.keySet()) {
        if (key.equals("type")) {
          continue;
        }
        
        if (! isFirst)
          cb.append(',');
        isFirst = false;
  
        cb.append(key);
        cb.append('=');
  
        String value = properties.get(key);
        
        if (value == null) {
          throw new NullPointerException(String.valueOf(key));
        }
  
        if (value.length() == 0
            || (escapePattern.matcher(value).find()
                && ! (value.startsWith("\"") && value.endsWith("\"")))) {
          value = ObjectName.quote(value);
        }
        
        cb.append(value);
      }
  
      return new ObjectName(cb.toString());
    }
docs: Creates the clean name