protected <K, V> void mergePartitionAttributes(
      final RegionFactory<K, V> regionFactory, final RegionAttributes<K, V> regionAttributes) {

    // NOTE PartitionAttributes are created by certain RegionShortcuts; need the null check since
    // RegionAttributes
    // can technically return null!
    // NOTE most likely, the PartitionAttributes will never be null since the
    // PartitionRegionFactoryBean always
    // sets a PartitionAttributesFactoryBean BeanBuilder on the RegionAttributesFactoryBean
    // "partitionAttributes"
    // property.
    if (regionAttributes.getPartitionAttributes() != null) {
      PartitionAttributes partitionAttributes = regionAttributes.getPartitionAttributes();
      PartitionAttributesFactory partitionAttributesFactory =
          new PartitionAttributesFactory(partitionAttributes);
      RegionShortcutWrapper shortcutWrapper = RegionShortcutWrapper.valueOf(shortcut);

      // NOTE however, since the default value of redundancy is 0, we need to account for
      // 'redundant'
      // RegionShortcut types, which specify a redundancy of 1.
      if (shortcutWrapper.isRedundant() && partitionAttributes.getRedundantCopies() == 0) {
        partitionAttributesFactory.setRedundantCopies(1);
      }

      // NOTE and, since the default value of localMaxMemory is based on the system memory, we need
      // to account for
      // 'proxy' RegionShortcut types, which specify a local max memory of 0.
      if (shortcutWrapper.isProxy()) {
        partitionAttributesFactory.setLocalMaxMemory(0);
      }

      // NOTE internally, RegionFactory.setPartitionAttributes handles merging the
      // PartitionAttributes, hooray!
      regionFactory.setPartitionAttributes(partitionAttributesFactory.create());
    }
  }
  public RegionAttributesInfo(RegionAttributes<?, ?> ra) {

    cloningEnabled = ra.getCloningEnabled();
    concurrencyChecksEnabled = ra.getConcurrencyChecksEnabled();
    concurrencyLevel = ra.getConcurrencyLevel();
    dataPolicy = ra.getDataPolicy();
    diskStoreName = ra.getDiskStoreName();
    enableAsyncConflation = ra.getEnableAsyncConflation();
    enableGateway = ra.getEnableGateway();
    enableSubscriptionConflation = ra.getEnableSubscriptionConflation();
    gatewayHubId = ra.getGatewayHubId();
    ignoreJTA = ra.getIgnoreJTA();
    indexMaintenanceSynchronous = ra.getIndexMaintenanceSynchronous();
    initialCapacity = ra.getInitialCapacity();
    loadFactor = ra.getLoadFactor();
    multicastEnabled = ra.getMulticastEnabled();
    poolName = ra.getPoolName();
    scope = ra.getScope();
    statisticsEnabled = ra.getStatisticsEnabled();
    entryTimeToLive = ra.getEntryTimeToLive().getTimeout();
    isLockGrantor = ra.isLockGrantor();
    entryIdleTimeout = ra.getEntryIdleTimeout().getTimeout();
    regionIdleTimeout = ra.getRegionIdleTimeout().getTimeout();
    regionTimeToLive = ra.getRegionTimeToLive().getTimeout();

    Compressor compressor = ra.getCompressor();
    if (compressor != null) {
      compressorClassName = compressor.getClass().getCanonicalName();
    }

    ExpirationAction expAction = ra.getEntryIdleTimeout().getAction();
    if (expAction != null) {
      entryIdleTimeoutAction = expAction.toString();
    }

    expAction = ra.getEntryTimeToLive().getAction();
    if (expAction != null) {
      entryTimeToLiveAction = expAction.toString();
    }

    expAction = ra.getRegionTimeToLive().getAction();

    if (expAction != null) {
      regionTimeToLiveAction = expAction.toString();
    }

    expAction = ra.getRegionIdleTimeout().getAction();
    if (expAction != null) {
      regionIdleTimeoutAction = expAction.toString();
    }

    // Collecting information about all the CacheListeners, CacheWriters, CacheLoaders
    CacheListener<?, ?>[] cacheListeners = ra.getCacheListeners();

    // TODO: The cacheListeners should be added one by one by delimited by a "\n"
    if (cacheListeners.length > 0) {
      cacheListenerClassNames = new ArrayList<String>();
      for (CacheListener<?, ?> cacheListener : cacheListeners) {
        cacheListenerClassNames.add(cacheListener.getClass().getCanonicalName());
      }
      Collections.sort(cacheListenerClassNames);
    }

    // CacheLoader
    CacheLoader<?, ?> cacheLoader = ra.getCacheLoader();

    if (cacheLoader != null) {
      cacheLoaderClassName = cacheLoader.getClass().getCanonicalName();
    }

    // CacheWriter
    CacheWriter<?, ?> cacheWriter = ra.getCacheWriter();

    if (cacheWriter != null) {
      cacheWriterClassName = cacheWriter.getClass().getCanonicalName();
    }

    // Setting the Partition Attributes and Eviction Attributes
    PartitionAttributes<?, ?> partitionAttributes = ra.getPartitionAttributes();
    EvictionAttributes evictionAttributes = ra.getEvictionAttributes();

    if (partitionAttributes != null)
      partitionAttributesInfo = new PartitionAttributesInfo(partitionAttributes);

    if (evictionAttributes != null) {
      evictionAttributesInfo = new EvictionAttributesInfo(evictionAttributes);
    }
  }