public <C> CacheManagerBuilder<T> withSerializer(Class<C> clazz, Class<? extends Serializer<C>> serializer) {
    DefaultSerializationProviderConfiguration service = configBuilder.findServiceByClass(DefaultSerializationProviderConfiguration.class);
    if (service == null) {
      service = new DefaultSerializationProviderConfiguration();
      service.addSerializerFor(clazz, serializer);
      return new CacheManagerBuilder<>(this, configBuilder.addService(service));
    } else {
      DefaultSerializationProviderConfiguration newConfig = new DefaultSerializationProviderConfiguration(service);
      newConfig.addSerializerFor(clazz, serializer, true);
      return new CacheManagerBuilder<>(this, configBuilder.removeService(service).addService(newConfig));
    }
  }
public < C > CacheManagerBuilder < T > withSerializer ( Class < C > clazz , Class < ? extends Serializer < C > > serializer ) { DefaultSerializationProviderConfiguration service = configBuilder . findServiceByClass ( DefaultSerializationProviderConfiguration . class ) ; if ( service == null ) { service = new DefaultSerializationProviderConfiguration ( ) ; service . addSerializerFor ( clazz , serializer ) ; return new CacheManagerBuilder < > ( this , configBuilder . addService ( service ) ) ; } else { DefaultSerializationProviderConfiguration newConfig = new DefaultSerializationProviderConfiguration ( service ) ; newConfig . addSerializerFor ( clazz , serializer , true ) ; return new CacheManagerBuilder < > ( this , configBuilder . removeService ( service ) . addService ( newConfig ) ) ; } }
Adds a default {@link Serializer} for the specified type to the returned builder.

@param clazz the {@code Class} for which the serializer is
@param serializer the {@code Serializer} instance
@param <C> the type which can be serialized
@return a new builder with the added default serializer