
io.leopard.commons.utility.ClassUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leopard-lang Show documentation
Show all versions of leopard-lang Show documentation
异常类、Util类、Leopard自定义的数据类型等
package io.leopard.commons.utility;
import io.leopard.core.exception.ClassNotFoundRuntimeException;
public class ClassUtil {
public static Class> forName(String className) {
try {
return Class.forName(className);
}
catch (ClassNotFoundException e) {
throw new ClassNotFoundRuntimeException(e.getMessage(), e);
}
}
public static boolean exist(String className) {
try {
Class.forName(className);
return true;
}
catch (ClassNotFoundException e) {
return false;
}
}
public static T newInstance(Class clazz) {
try {
return clazz.newInstance();
}
catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy