public static <K, V> ConfigurationAdapter<K, V> create(Configuration<K, V> c) {
   // A configuration copy as required by the spec
   if (c instanceof CompleteConfiguration) {
     return new ConfigurationAdapter<K, V>(
         new MutableConfiguration<K, V>((CompleteConfiguration<K, V>) c));
   } else {
     // support use of Basic Configuration
     MutableConfiguration<K, V> mutableConfiguration = new MutableConfiguration<K, V>();
     mutableConfiguration.setStoreByValue(c.isStoreByValue());
     mutableConfiguration.setTypes(c.getKeyType(), c.getValueType());
     return new ConfigurationAdapter<K, V>(new MutableConfiguration<K, V>(mutableConfiguration));
   }
 }
  public Eh107CompleteConfiguration(
      Configuration<K, V> config,
      final CacheConfiguration<K, V> ehcacheConfig,
      boolean useEhcacheExpiry,
      boolean useEhcacheLoaderWriter) {
    this.ehcacheConfig = ehcacheConfig;
    this.keyType = config.getKeyType();
    this.valueType = config.getValueType();
    this.isStoreByValue = isStoreByValue(config, ehcacheConfig);

    Factory<ExpiryPolicy> tempExpiryPolicyFactory = EternalExpiryPolicy.factoryOf();

    if (config instanceof CompleteConfiguration) {
      CompleteConfiguration<K, V> completeConfig = (CompleteConfiguration<K, V>) config;
      this.isReadThrough = completeConfig.isReadThrough();
      this.isWriteThrough = completeConfig.isWriteThrough();
      this.isStatisticsEnabled = completeConfig.isStatisticsEnabled();
      this.isManagementEnabled = completeConfig.isManagementEnabled();

      if (useEhcacheLoaderWriter) {
        this.cacheLoaderFactory = createThrowingFactory();
        this.cacheWriterFactory = createThrowingFactory();
      } else {
        this.cacheLoaderFactory = completeConfig.getCacheLoaderFactory();
        this.cacheWriterFactory = completeConfig.getCacheWriterFactory();
      }

      tempExpiryPolicyFactory = completeConfig.getExpiryPolicyFactory();
      for (CacheEntryListenerConfiguration<K, V> listenerConfig :
          completeConfig.getCacheEntryListenerConfigurations()) {
        cacheEntryListenerConfigs.add(listenerConfig);
      }
    } else {
      this.isReadThrough = false;
      this.isWriteThrough = false;
      this.isStatisticsEnabled = false;
      this.isManagementEnabled = false;
      this.cacheLoaderFactory = null;
      this.cacheWriterFactory = null;
    }

    if (useEhcacheExpiry) {
      tempExpiryPolicyFactory = createThrowingFactory();
    }

    this.expiryPolicyFactory = tempExpiryPolicyFactory;
  }