org.unlaxer.util.Singletons Maven / Gradle / Ivy
package org.unlaxer.util;
public class Singletons {
static FactoryBoundCache, Object>//
singletons = new FactoryBoundCache<>((clazz) -> {
try {
return clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
@SuppressWarnings("unchecked")
public static T get(Class clazz) {
return (T) singletons.get(clazz);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy