play.inject.DefaultBeanSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
RePlay is a fork of the Play1 framework, created by Codeborne.
package play.inject;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
public class DefaultBeanSource implements BeanSource {
@Override
public T getBeanOfType(Class clazz) {
try {
Constructor constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Cannot instantiate " + clazz, e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy