private void generate(PartitionAttributes<?, ?> pa) throws SAXException {
    AttributesImpl atts = new AttributesImpl();

    if (generateDefaults() || pa.getRedundantCopies() != 0) {
      atts.addAttribute("", "", PARTITION_REDUNDANT_COPIES, "",
          String.valueOf(pa.getRedundantCopies()));
    }

    if (version.compareTo(CacheXmlVersion.GEMFIRE_5_1) >= 0) {
      if (generateDefaults()
          || pa.getLocalMaxMemory() != ((PartitionAttributesImpl) pa).getLocalMaxMemoryDefault()) {
        atts.addAttribute("", "", LOCAL_MAX_MEMORY, "", String.valueOf(pa.getLocalMaxMemory()));
      }
      if (generateDefaults()
          || pa.getTotalMaxMemory() != PartitionAttributesFactory.GLOBAL_MAX_MEMORY_DEFAULT) {
        atts.addAttribute("", "", TOTAL_MAX_MEMORY, "", String.valueOf(pa.getTotalMaxMemory()));
      }
      if (generateDefaults()
          || pa.getTotalNumBuckets() != PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_DEFAULT) {
        atts.addAttribute("", "", TOTAL_NUM_BUCKETS, "", String.valueOf(pa.getTotalNumBuckets()));
      }
    } // GEMFIRE_5_1

    if (version.compareTo(CacheXmlVersion.GEMFIRE_5_8) >= 0) {
      if (pa.getColocatedWith() != null) {
        atts.addAttribute("", "", PARTITION_COLOCATED_WITH, "", pa.getColocatedWith());
      }

    }
    if (version.compareTo(CacheXmlVersion.GEMFIRE_6_0) >= 0) {
      if (generateDefaults()
          || pa.getRecoveryDelay() != PartitionAttributesFactory.RECOVERY_DELAY_DEFAULT) {
        atts.addAttribute("", "", RECOVERY_DELAY, "", String.valueOf(pa.getRecoveryDelay()));
      }
      if (generateDefaults() || pa
          .getStartupRecoveryDelay() != PartitionAttributesFactory.STARTUP_RECOVERY_DELAY_DEFAULT) {
        atts.addAttribute("", "", STARTUP_RECOVERY_DELAY, "",
            String.valueOf(pa.getStartupRecoveryDelay()));
      }
    }

    if (!generateDefaults() && atts.getLength() == 0 && pa.getPartitionResolver() == null
        && pa.getPartitionListeners().length == 0 && (pa.getFixedPartitionAttributes() == null
            || pa.getFixedPartitionAttributes().isEmpty())) {
      return;
    }

    handler.startElement("", PARTITION_ATTRIBUTES, PARTITION_ATTRIBUTES, atts);

    if (version.compareTo(CacheXmlVersion.GEMFIRE_5_8) >= 0) {
      PartitionResolver rr = pa.getPartitionResolver();
      if (rr != null) {
        generate(rr);
      }
    }

    if (version.compareTo(CacheXmlVersion.GEMFIRE_6_1) >= 0) {
      PartitionListener[] listeners = pa.getPartitionListeners();
      for (PartitionListener listener : listeners) {
        if (listener != null) {
          generate(listener);
        }
      }
    }

    if (version.compareTo(CacheXmlVersion.GEMFIRE_6_6) >= 0) {
      List<FixedPartitionAttributes> staticAttrs = pa.getFixedPartitionAttributes();
      if (staticAttrs != null) {
        generateFixedPartitionAttributes(staticAttrs);
      }
    }

    if (version.compareTo(CacheXmlVersion.GEMFIRE_5_1) < 0) {
      Properties p = pa.getLocalProperties();
      generate(p, LOCAL_PROPERTIES);

      p = pa.getGlobalProperties();
      generate(p, GLOBAL_PROPERTIES);
    }

    handler.endElement("", PARTITION_ATTRIBUTES, PARTITION_ATTRIBUTES);
  }
Generates XML for a <code>PartitionAttributes</code>
geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java