コード例 #1
0
 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));
   }
 }
コード例 #2
0
 private static <K, V> boolean isStoreByValue(
     Configuration<K, V> config, CacheConfiguration<K, V> ehcacheConfig) {
   if (ehcacheConfig != null) {
     Collection<ServiceConfiguration<?>> serviceConfigurations =
         ehcacheConfig.getServiceConfigurations();
     for (ServiceConfiguration<?> serviceConfiguration : serviceConfigurations) {
       if (serviceConfiguration instanceof DefaultCopierConfiguration) {
         DefaultCopierConfiguration copierConfig =
             (DefaultCopierConfiguration) serviceConfiguration;
         if (copierConfig.getType().equals(DefaultCopierConfiguration.Type.VALUE)) {
           if (copierConfig.getClazz().isAssignableFrom(IdentityCopier.class)) {
             return false;
           } else {
             return true;
           }
         }
       }
     }
   }
   return config.isStoreByValue();
 }