// Path: src/main/java/org/weakref/jmx/ObjectNameGenerator.java
// public interface ObjectNameGenerator
// {
//     static ObjectNameGenerator defaultObjectNameGenerator()
//     {
//         return (type, properties) -> new ObjectNameBuilder(type.getPackage().getName())
//                 .withProperties(properties)
//                 .build();
//     }
// 
//     default String generatedNameOf(Class<?> type)
//     {
//         return generatedNameOf(type, ImmutableMap.of("name", type.getSimpleName()));
//     }
// 
//     default String generatedNameOf(Class<?> type, String name)
//     {
//         return generatedNameOf(type, ImmutableMap.<String, String>builder()
//                 .put("type", type.getSimpleName())
//                 .put("name", name)
//                 .build());
//     }
// 
//     String generatedNameOf(Class<?> type, Map<String, String> properties);
// }


import com.google.inject.multibindings.Multibinder;
import org.weakref.jmx.ObjectNameGenerator;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import java.util.Map.Entry;
import java.util.function.BiFunction;
        };

        as(nameFactory);
    }

    public void withGeneratedName(ObjectNameFunction<V> valueNamingFunction)
    {
        as((factory, entry) -> valueNamingFunction.name(entry.getValue()));
    }

    public void withGeneratedName(MapNamingFunction<K, V> valueNamingFunction)
    {
        BiFunction<ObjectNameGenerator, Entry<K, V>, ObjectName> nameFactory = (factory, entry) -> {
            try {
                String itemName = valueNamingFunction.name(entry.getKey(), entry.getValue());
                return new ObjectName(factory.generatedNameOf(valueClass, itemName));
            }
            catch (MalformedObjectNameException e) {
                throw new RuntimeException(e);
            }
        };

        as(nameFactory);
    }

    public void withGeneratedName(MapObjectNameFunction<K, V> valueNamingFunction)
    {
        as((factory, entry) -> valueNamingFunction.name(entry.getKey(), entry.getValue()));
    }

// Path: src/main/java/org/weakref/jmx/ObjectNameGenerator.java
// public interface ObjectNameGenerator
// {
//     static ObjectNameGenerator defaultObjectNameGenerator()
//     {
//         return (type, properties) -> new ObjectNameBuilder(type.getPackage().getName())
//                 .withProperties(properties)
//                 .build();
//     }
// 
//     default String generatedNameOf(Class<?> type)
//     {
//         return generatedNameOf(type, ImmutableMap.of("name", type.getSimpleName()));
//     }
// 
//     default String generatedNameOf(Class<?> type, String name)
//     {
//         return generatedNameOf(type, ImmutableMap.<String, String>builder()
//                 .put("type", type.getSimpleName())
//                 .put("name", name)
//                 .build());
//     }
// 
//     String generatedNameOf(Class<?> type, Map<String, String> properties);
// }


// Path: src/main/java/org/weakref/jmx/guice/MapExportBinder.java
import com.google.inject.multibindings.Multibinder;
import org.weakref.jmx.ObjectNameGenerator;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import java.util.Map.Entry;
import java.util.function.BiFunction;

        };

        as(nameFactory);
    }

    public void withGeneratedName(ObjectNameFunction<V> valueNamingFunction)
    {
        as((factory, entry) -> valueNamingFunction.name(entry.getValue()));
    }

    public void withGeneratedName(MapNamingFunction<K, V> valueNamingFunction)
    {
        BiFunction<ObjectNameGenerator, Entry<K, V>, ObjectName> nameFactory = (factory, entry) -> {
            try {
                String itemName = valueNamingFunction.name(entry.getKey(), entry.getValue());
                return new ObjectName(factory.generatedNameOf(valueClass, itemName));
            }
            catch (MalformedObjectNameException e) {
                throw new RuntimeException(e);
            }
        };

        as(nameFactory);
    }

    public void withGeneratedName(MapObjectNameFunction<K, V> valueNamingFunction)
    {
        as((factory, entry) -> valueNamingFunction.name(entry.getKey(), entry.getValue()));
    }

    public void as(BiFunction<ObjectNameGenerator, Entry<K, V>, ObjectName> nameFactory)