docs: public String toMetatypeString(boolean includeHeaders) {
          for (MetatypeOcd ocd : ocds) {
              ocd.setParentMetatype(this);
              ocd.sort(true);
          }
  
          int padSpaces = 0;
          StringBuilder sb = new StringBuilder();
  
          if (includeHeaders) {
              ++padSpaces;
  
              sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append(Utils.NEW_LINE);
              sb.append("<!-- Created by Metatype Generator (").append(new Date()).append(") -->").append(Utils.NEW_LINE);
              sb.append("<metatype:MetaData xmlns:metatype=\"http://www.osgi.org/xmlns/metatype/v1.1.0\"").append(Utils.NEW_LINE);
              sb.append("                   xmlns:ibm=\"http://www.ibm.com/xmlns/appservers/osgi/metatype/v1.0.0\"").append(Utils.NEW_LINE);
              sb.append("                   xmlns:ibmui=\"http://www.ibm.com/xmlns/appservers/osgi/metatype/ui/v1.0.0\"").append(Utils.NEW_LINE);
              sb.append("                   localization=\"OSGI-INF/l10n/metatype\">").append(Utils.NEW_LINE);
              sb.append(Utils.NEW_LINE);
          } else
              sb.append("<!-- Created by Metatype Generator (").append(new Date()).append(") -->").append(Utils.NEW_LINE);
  
          String buffer = Utils.getSpaceBufferString(padSpaces);
  
          for (MetatypeDesignate designate : this.designates) {
              if (designate.getPid() != null) {
                  sb.append(buffer).append("<Designate pid=\"").append(designate.getPid()).append("\">").append(Utils.NEW_LINE);
                  sb.append(designate.getObject().toMetatypeString(padSpaces + 1)).append(Utils.NEW_LINE);
                  sb.append(buffer).append("</Designate>").append(Utils.NEW_LINE);
              } else if (designate.getFactoryPid() != null) {
                  sb.append(buffer).append("<Designate factoryPid=\"").append(designate.getFactoryPid()).append("\">").append(Utils.NEW_LINE);
                  sb.append(designate.getObject().toMetatypeString(padSpaces + 1)).append(Utils.NEW_LINE);
                  sb.append(buffer).append("</Designate>").append(Utils.NEW_LINE);
              }
  
              sb.append(Utils.NEW_LINE);
              MetatypeOcd ocd = getOcdById(designate.getObject().getOcdref());
              sb.append(ocd.toMetatypeString(padSpaces)).append(Utils.NEW_LINE);
              sb.append(Utils.NEW_LINE);
          }
  
          if (includeHeaders) {
              sb.append("</metatype:MetaData>");
          }
  
          return sb.toString();
      }