/**
  * Returns a JSON representation of the object. This method is the counterpart to the
  * PropertyGroup(String) constructor.
  *
  * @return a JSON object
  */
 @Override
 public JSONObject toJson() {
   JSONObject json = super.toJson();
   List<JSONValue> jsonProperties = new ArrayList<JSONValue>();
   for (JSONMetaDataObject property : properties) {
     jsonProperties.add(property.toJson());
   }
   json.put(PROPERTIES, JsonUtil.buildArray(jsonProperties));
   return json;
 }
  /**
   * Retrieve a property or property group by name.
   *
   * @param name name of property to retrieve.
   * @return null on failure
   */
  public JSONMetaDataObject getElement(final String name) {
    JSONMetaDataObject ret = null; // assume failure

    if (name != null) {
      for (JSONMetaDataObject property : properties) {
        // did we find the desired property
        if (property.getName().equals(name)) {
          ret = property;
          break;
        }
      }
    }

    return ret;
  }