org.weakref.jmx.guice.SetMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmxutils Show documentation
Show all versions of jmxutils Show documentation
Exporting JMX mbeans made easy
package org.weakref.jmx.guice;
import org.weakref.jmx.internal.guava.reflect.TypeParameter;
import org.weakref.jmx.internal.guava.reflect.TypeToken;
import com.google.inject.Key;
import java.lang.reflect.Type;
import java.util.Set;
class SetMapping
{
private final ObjectNameFunction objectNameFunction;
private final Class clazz;
SetMapping(Class key, ObjectNameFunction objectNameFunction)
{
this.clazz = key;
this.objectNameFunction = objectNameFunction;
}
public ObjectNameFunction getObjectNameFunction()
{
return objectNameFunction;
}
public Key> getKey()
{
return (Key>) Key.get(setOf(clazz));
}
private static Type setOf(Class clazz)
{
return new TypeToken>() {}.where(new TypeParameter() {}, TypeToken.of(clazz)).getType();
}
}