trip.jsr.cdi.CDILoaderOfClasses Maven / Gradle / Ivy
package trip.jsr.cdi;
@SuppressWarnings("unchecked")
abstract class CDILoaderOfClasses {
static final String ANNOTATION_PRODUCES = "javax.enterprise.inject.Produces";
static Class extends T> loadClass( String className ){
try {
return (Class extends T>)Class.forName(className);
} catch (final ClassNotFoundException e) {
return null;
}
}
static boolean isClassPresent( String className ){
return loadClass(className) != null;
}
static T newInstanceOf( String className, Class supertype ){
try {
return (T)loadClass(className).newInstance();
} catch (InstantiationException | IllegalAccessException e) {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy