Source:
<code>private <K, V> CacheConfigurationBuilder<K, V> handleStoreByValue(Eh107CompleteConfiguration<K, V> jsr107Configuration, CacheConfigurationBuilder<K, V> builder, String cacheName) { DefaultCopierConfiguration copierConfig = builder.getExistingServiceConfiguration(DefaultCopierConfiguration.class); if(copierConfig == null) { if(jsr107Configuration.isStoreByValue()) { if (xmlConfiguration != null) { <START> for (ServiceCreationConfiguration<?> serviceCreationConfiguration : xmlConfiguration.getServiceCreationConfigurations()) { <END> if (serviceCreationConfiguration instanceof DefaultCopyProviderConfiguration) { Map<Class<?>, ClassInstanceConfiguration<Copier<?>>> defaults = ((DefaultCopyProviderConfiguration) serviceCreationConfiguration) .getDefaults(); boolean matchingDefault = false; if (!defaults.containsKey(jsr107Configuration.getKeyType())) { builder = builder.add(new DefaultCopierConfiguration<K>((Class) SerializingCopier.class, CopierConfiguration.Type.KEY)); } else { matchingDefault = true; } if (!defaults.containsKey(jsr107Configuration.getValueType())) { builder = builder.add(new DefaultCopierConfiguration<K>((Class) SerializingCopier.class, CopierConfiguration.Type.VALUE)); } else { matchingDefault = true; } if (matchingDefault) { LOG.info("CacheManager level copier configuration overwriting JSR-107 by-value semantics for cache {}", cacheName); } return builder; } } } builder = builder.add(new DefaultCopierConfiguration<K>((Class)SerializingCopier.class, CopierConfiguration.Type.KEY)) .add(new DefaultCopierConfiguration<K>((Class)SerializingCopier.class, CopierConfiguration.Type.VALUE)); LOG.debug("Using default SerializingCopier for JSR-107 store-by-value cache {}", cacheName); } } else { LOG.info("Cache level copier configuration overwriting JSR-107 by-value semantics for cache {}", cacheName); } return builder; }</code><technical_language>findSingletonAmongst</technical_language>

Target:
private <K, V> CacheConfigurationBuilder<K, V> handleStoreByValue(Eh107CompleteConfiguration<K, V> jsr107Configuration, CacheConfigurationBuilder<K, V> builder, String cacheName) { DefaultCopierConfiguration copierConfig = builder.getExistingServiceConfiguration(DefaultCopierConfiguration.class); if(copierConfig == null) { if(jsr107Configuration.isStoreByValue()) { if (xmlConfiguration != null) { DefaultCopyProviderConfiguration defaultCopyProviderConfiguration = findSingletonAmongst(DefaultCopyProviderConfiguration.class, xmlConfiguration.getServiceCreationConfigurations().toArray()); if (defaultCopyProviderConfiguration != null) { Map<Class<?>, ClassInstanceConfiguration<Copier<?>>> defaults = defaultCopyProviderConfiguration.getDefaults(); boolean matchingDefault = false; if (defaults.containsKey(jsr107Configuration.getKeyType())) { matchingDefault = true; } else { builder = builder.add(new DefaultCopierConfiguration<K>((Class) SerializingCopier.class, CopierConfiguration.Type.KEY)); } if (defaults.containsKey(jsr107Configuration.getValueType())) { matchingDefault = true; } else { builder = builder.add(new DefaultCopierConfiguration<K>((Class) SerializingCopier.class, CopierConfiguration.Type.VALUE)); } if (matchingDefault) { LOG.info("CacheManager level copier configuration overwriting JSR-107 by-value semantics for cache {}", cacheName); } return builder; } } builder = builder.add(new DefaultCopierConfiguration<K>((Class)SerializingCopier.class, CopierConfiguration.Type.KEY)) .add(new DefaultCopierConfiguration<K>((Class)SerializingCopier.class, CopierConfiguration.Type.VALUE)); LOG.debug("Using default SerializingCopier for JSR-107 store-by-value cache {}", cacheName); } } else { LOG.info("Cache level copier configuration overwriting JSR-107 by-value semantics for cache {}", cacheName); } return builder; }