// 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.Key;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Named;
import org.weakref.jmx.ObjectNameGenerator;
import java.util.function.Function;
        this.binder = binder;
        this.key = key;
    }

    /**
     * Names the MBean according to {@link org.weakref.jmx.ObjectNames} name generator methods.
     */
    public void withGeneratedName()
    {
        if (key.getAnnotation() != null) {
            if (key.getAnnotation() instanceof Named) {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), ((Named) key.getAnnotation()).value()));
            }
            else {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotation().annotationType().getSimpleName()));
            }
        }
        else if (key.getAnnotationType() != null) {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotationType().getSimpleName()));
        }
        else {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType()));
        }
    }

    public void as(String name)
    {
        as(factory -> name);
    }

// 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/NamedExportBinder.java
import com.google.inject.Key;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Named;
import org.weakref.jmx.ObjectNameGenerator;
import java.util.function.Function;

        this.binder = binder;
        this.key = key;
    }

    /**
     * Names the MBean according to {@link org.weakref.jmx.ObjectNames} name generator methods.
     */
    public void withGeneratedName()
    {
        if (key.getAnnotation() != null) {
            if (key.getAnnotation() instanceof Named) {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), ((Named) key.getAnnotation()).value()));
            }
            else {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotation().annotationType().getSimpleName()));
            }
        }
        else if (key.getAnnotationType() != null) {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotationType().getSimpleName()));
        }
        else {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType()));
        }
    }

    public void as(String name)
    {
        as(factory -> name);
    }

    public void as(Function<ObjectNameGenerator, String> nameFactory)